Skip to content

Commit

Permalink
Refactor test to work with slices.IndexFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 authored and inancgumus committed Feb 14, 2025
1 parent 046fbcf commit 6f26ce7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions internal/js/modules/k6/browser/tests/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2422,13 +2422,7 @@ func TestPageOnRequest(t *testing.T) {

// Compare each request one by one for better test failure visibility
for _, req := range requests {
i := -1
for j, e := range expected {
if req.URL == e.URL {
i = j
break
}
}
i := slices.IndexFunc(expected, func(r request) bool { return req.URL == r.URL })
assert.NotEqual(t, -1, i, "failed to find expected request with URL %s", req.URL)

sortByName := func(m1, m2 map[string]string) int {
Expand Down

0 comments on commit 6f26ce7

Please sign in to comment.