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 committed Jan 31, 2025
1 parent 4248133 commit 8d5b9d1
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 @@ -2404,13 +2404,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 8d5b9d1

Please sign in to comment.