Skip to content

Commit

Permalink
Fixes typos
Browse files Browse the repository at this point in the history
  • Loading branch information
cuducos committed Nov 14, 2023
1 parent bbcba5f commit 4810138
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestAllowedHostWrap(t *testing.T) {
}{
{"", http.StatusOK},
{"127.0.0.1", http.StatusOK},
{"fourty-two", http.StatusTeapot},
{"forty-two", http.StatusTeapot},
} {
t.Run(fmt.Sprintf("test returns %d when allowed host is %s", c.status, c.allowedHost), func(t *testing.T) {
req, err := http.NewRequest(http.MethodGet, "/19131243000197", nil)
Expand Down
2 changes: 1 addition & 1 deletion cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Downloads the required ZIP and Excel files.
The main files are downloaded from the official website of the Brazilian
Federal Revenue. An extra Excel file is downloaded from IBGE. Since the server
is extremelly slow, all files are downloaded using multiple HTTP requests with
is extremely slow, all files are downloaded using multiple HTTP requests with
small content ranges.`

urlsHelper = `
Expand Down
2 changes: 1 addition & 1 deletion cmd/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

const transformHelper = `
Convert ths CSV files from the Federal Revenue for venues (ESTABELE group of
Convert the CSV files from the Federal Revenue for venues (ESTABELE group of
files) into records in the database, 1 record per CNPJ, joining information
from all other source CSV files.`

Expand Down
2 changes: 1 addition & 1 deletion db/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (p *PostgreSQL) PreLoad() error {
return nil
}

// PostLoad runs after loading data into the database. Currenlty it re-enables
// PostLoad runs after loading data into the database. Currently it re-enables
// autovacuum on PostgreSQL.
func (p *PostgreSQL) PostLoad() error {
if _, err := p.pool.Exec(context.Background(), p.sql["post_load"]); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions db/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func TestPostgresDB(t *testing.T) {
id := 33683111000280
json := `{"qsa": [{"name": 42}, {"name": "fourty-two"}], "answer": 42}`
json := `{"qsa": [{"name": 42}, {"name": "forty-two"}], "answer": 42}`

u := os.Getenv("TEST_DATABASE_URL")
if u == "" {
Expand Down Expand Up @@ -62,14 +62,14 @@ func TestPostgresDB(t *testing.T) {
if metadata != "42" {
t.Errorf("expected 42 as the answer, got %s", metadata)
}
if err := pg.MetaSave("answer", "fourty-two"); err != nil {
if err := pg.MetaSave("answer", "forty-two"); err != nil {
t.Errorf("expected no error re-writing to the metadata table, got %s", err)
}
metadata2, err := pg.MetaRead("answer")
if err != nil {
t.Errorf("expected no error getting metadata for the second time, got %s", err)
}
if metadata2 != "fourty-two" {
if metadata2 != "forty-two" {
t.Errorf("expected foruty-two as the answer, got %s", metadata2)
}
}
2 changes: 1 addition & 1 deletion download/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestGetURLs(t *testing.T) {
defer ts.Close()
got, err := getURLs(ts.URL, tc.handler, t.TempDir(), true)
if err != nil {
t.Errorf("expected to run withour errors, got: %v:", err)
t.Errorf("expected to run without errors, got: %v:", err)
return
}
if len(got) != tc.expected {
Expand Down
2 changes: 1 addition & 1 deletion download/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
// DefaultChunkSize sets the size of the chunks to be dowloaded using HTTP
// DefaultChunkSize sets the size of the chunks to be downloaded using HTTP
// requests by bytes range
DefaultChunkSize = 1_048_576

Expand Down
4 changes: 2 additions & 2 deletions download/federal_revenue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestFederalRevenueGetURLs(t *testing.T) {
t.Run("returns download urls", func(t *testing.T) {
got, err := federalRevenueGetURLs(ts.URL, tmp)
if err != nil {
t.Errorf("expected to run withour errors, got: %v:", err)
t.Errorf("expected to run without errors, got: %v:", err)
}
expected := []string{
"https://dadosabertos.rfb.gov.br/CNPJ/Cnaes.zip",
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestFederalRevenueGetURLs(t *testing.T) {
t.Run("saves updated at date", func(t *testing.T) {
_, err := federalRevenueGetURLs(ts.URL, tmp)
if err != nil {
t.Errorf("expected to run withour errors, got: %v:", err)
t.Errorf("expected to run without errors, got: %v:", err)
}
pth := filepath.Join(tmp, FederalRevenueUpdatedAt)
got, err := os.ReadFile(pth)
Expand Down
2 changes: 1 addition & 1 deletion download/national_treasure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func TestNationalTreasureGetURLs(t *testing.T) {
defer ts.Close()
got, err := nationalTreasureGetURLs(ts.URL, t.TempDir())
if err != nil {
t.Errorf("expected to run withour errors, got: %v:", err)
t.Errorf("expected to run without errors, got: %v:", err)
return
}
expected := []string{
Expand Down
2 changes: 1 addition & 1 deletion transform/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func keyForPartners(n string) string { return fmt.Sprintf("partners%s", n) }
func keyForBase(n string) string { return fmt.Sprintf("base%s", n) }
func keyForTaxes(n string) string { return fmt.Sprintf("taxes%s", n) }

// fucntions to read data from Badger
// functions to read data from Badger

func partnersOf(db *badger.DB, n string) ([]partnerData, error) {
p := []partnerData{}
Expand Down
6 changes: 3 additions & 3 deletions transform/badger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestSaveAndReadItems(t *testing.T) {
}
got, err := partnersOf(db, testBaseCNPJ)
if err != nil {
t.Errorf("expexted no error reading partners, got %s", err)
t.Errorf("expected no error reading partners, got %s", err)
}
if len(got) != 1 {
t.Errorf("expected merged partnes to have 1 partger, got %d", len(got))
Expand All @@ -174,7 +174,7 @@ func TestSaveAndReadItems(t *testing.T) {
}
got, err := baseOf(db, testBaseCNPJ)
if err != nil {
t.Errorf("expexted no error reading base, got %s", err)
t.Errorf("expected no error reading base, got %s", err)
}
if !reflect.DeepEqual(got, d) {
t.Errorf("expected %v, got %v", d, got)
Expand All @@ -192,7 +192,7 @@ func TestSaveAndReadItems(t *testing.T) {
}
got, err := taxesOf(db, testBaseCNPJ)
if err != nil {
t.Errorf("expexted no error reading taxes, got %s", err)
t.Errorf("expected no error reading taxes, got %s", err)
}
if !reflect.DeepEqual(got, d) {
t.Errorf("expected %v, got %v", d, got)
Expand Down
2 changes: 1 addition & 1 deletion transform/cast.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package transform incluse these cast functions to allow the project to
// Package transform includes these cast functions to allow the project to
// accomplish two things:
//
// - convert strings from the CSV files to other formats (e.g. int, float32,
Expand Down
4 changes: 2 additions & 2 deletions transform/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
func companyFromString(j string) (company, error) {
var c company
if err := json.Unmarshal([]byte(j), &c); err != nil {
return company{}, fmt.Errorf("error unmarshaling: %w", err)
return company{}, fmt.Errorf("error unmarshalling: %w", err)
}
return c, nil
}
Expand All @@ -34,7 +34,7 @@ func newTestDB(t *testing.T) *db.PostgreSQL {
return nil
}
if err := r.DropTable(); err != nil {
t.Errorf("expected no error droping the table in the test database, got %s", err)
t.Errorf("expected no error dropping the table in the test database, got %s", err)
return nil
}
if err := r.CreateTable(); err != nil {
Expand Down

0 comments on commit 4810138

Please sign in to comment.