Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions pkg/api/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package api_test

import (
"net/http"
"slices"
"strings"
"testing"

Expand Down Expand Up @@ -427,7 +428,7 @@ func TestEndpointOptions(t *testing.T) {
actualMethods := strings.Split(allowHeader, ", ")

for _, expectedMethod := range tt.expectedMethods {
if !contains(actualMethods, expectedMethod) {
if !slices.Contains(actualMethods, expectedMethod) {
t.Errorf("expected method %s not found for route %s", expectedMethod, tt.route)
}
}
Expand All @@ -436,12 +437,3 @@ func TestEndpointOptions(t *testing.T) {
})
}
}

func contains(slice []string, item string) bool {
for _, s := range slice {
if s == item {
return true
}
}
return false
}
17 changes: 3 additions & 14 deletions pkg/storer/netstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"errors"
"fmt"
"slices"
"testing"
"time"

Expand Down Expand Up @@ -52,13 +53,7 @@ func testNetStore(t *testing.T, newStorer func(r retrieval.Interface) (*storer.D
for {
select {
case op := <-lstore.PusherFeed():
found := false
for _, ch := range chunks {
if op.Chunk.Equal(ch) {
found = true
break
}
}
found := slices.ContainsFunc(chunks, op.Chunk.Equal)
if !found {
op.Err <- fmt.Errorf("incorrect chunk for push: have %s", op.Chunk.Address())
continue
Expand Down Expand Up @@ -110,13 +105,7 @@ func testNetStore(t *testing.T, newStorer func(r retrieval.Interface) (*storer.D
for {
select {
case op := <-lstore.PusherFeed():
found := false
for _, ch := range chunks {
if op.Chunk.Equal(ch) {
found = true
break
}
}
found := slices.ContainsFunc(chunks, op.Chunk.Equal)
if !found {
op.Err <- fmt.Errorf("incorrect chunk for push: have %s", op.Chunk.Address())
continue
Expand Down
Loading