feat: format and add test
This commit is contained in:
28
client/sets_test.go
Normal file
28
client/sets_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetSetByID(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
setID string
|
||||
wantErr bool
|
||||
wantSet *Set
|
||||
}{
|
||||
{"valid set", "xy1", false, &Set{ID: "xy1"}},
|
||||
{"invalid set", "invalid-id", true, nil},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
set, err := GetSetByID(tt.setID)
|
||||
|
||||
require.ErrorIs(t, err, ErrNotFound)
|
||||
require.Equal(t, tt.wantSet, set, "expected set: %v, got: %v for setID %v", tt.wantSet, set, tt.setID)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user