Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Dec 6, 2023
1 parent a9ee74f commit 37f38c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions handlers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ func TestAPICount(t *testing.T) {
// Calculate session from IP+UserAgent
{
APICountRequest{Hits: []APICountRequestHit{
{Path: "/foo", UserAgent: "Mozilla/5.0 (Linux) Firefox/1", IP: "66.66.66.66"},
{Path: "/foo", UserAgent: "Mozilla/5.0 (Linux) Firefox/1", IP: "51.171.91.33"},
{Path: "/foo", UserAgent: "Mozilla/5.0 (Linux) Firefox/1", IP: "66.66.66.67"},
{Path: "/foo", UserAgent: "Mozilla/5.0 (Linux) Firefox/1", IP: "66.66.66.66"},
{Path: "/foo", UserAgent: "Mozilla/5.0 (Linux) Firefox/1", IP: "51.171.91.33"},
}},
202, respOK, `
hit_id site_id path title event ua browser system session bot ref ref_s size loc first created_at
1 1 /foo 0 ~Z (~L) ~f1 Firefox 1 Linux 00112233445566778899aabbccddef01 0 NULL NL 1 2020-06-18 14:42:00
1 1 /foo 0 ~Z (~L) ~f1 Firefox 1 Linux 00112233445566778899aabbccddef01 0 NULL IE 1 2020-06-18 14:42:00
2 1 /foo 0 ~Z (~L) ~f1 Firefox 1 Linux 00112233445566778899aabbccddef02 0 NULL US 1 2020-06-18 14:42:00
3 1 /foo 0 ~Z (~L) ~f1 Firefox 1 Linux 00112233445566778899aabbccddef01 0 NULL NL 0 2020-06-18 14:42:00
3 1 /foo 0 ~Z (~L) ~f1 Firefox 1 Linux 00112233445566778899aabbccddef01 0 NULL IE 0 2020-06-18 14:42:00
`,
},

Expand Down
2 changes: 1 addition & 1 deletion hit_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestHitStats(t *testing.T) {
},
{
"id": "NL",
"name": "Netherlands",
"name": "The Netherlands",
"count": 1
}
]
Expand Down
6 changes: 3 additions & 3 deletions locations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ func TestLocations(t *testing.T) {
run := func() {
{
var l Location
err := l.Lookup(ctx, "66.66.66.66")
err := l.Lookup(ctx, "51.171.91.33")
if err != nil {
t.Fatal(err)
}

out := fmt.Sprintf("%#v", l)
want := `goatcounter.Location{ID:2, Country:"NL", Region:"", CountryName:"Netherlands", RegionName:"", ISO3166_2:"NL"}`
want := `goatcounter.Location{ID:2, Country:"IE", Region:"", CountryName:"Ireland", RegionName:"", ISO3166_2:"IE"}`
if out != want {
t.Error(out)
}
Expand All @@ -49,7 +49,7 @@ func TestLocations(t *testing.T) {
want := `
location_id iso_3166_2 country region country_name region_name
1 (unknown)
2 NL NL Netherlands
2 IE IE Ireland
3 US-TX US TX United States
4 US US United States`
if d := ztest.Diff(out, want, ztest.DiffNormalizeWhitespace); d != "" {
Expand Down

0 comments on commit 37f38c1

Please sign in to comment.