feat: format and add test

This commit is contained in:
2025-09-26 14:02:01 +02:00
parent 4de7a512f0
commit bdc2c88f83
4 changed files with 130 additions and 0 deletions

28
client/cards_test.go Normal file
View File

@@ -0,0 +1,28 @@
package client
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestGetCardByID(t *testing.T) {
tests := []struct {
name string
cardID string
wantErr bool
wantCard *Card
}{
{"valid card", "xy1-1", false, &Card{ID: "xy1-1"}},
{"invalid card", "invalid-id", true, nil},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
card, err := GetCardByID(tt.cardID)
require.ErrorIs(t, err, ErrNotFound)
require.Equal(t, tt.wantCard, card, "expected card: %v, got: %v for cardID %v", tt.wantCard, card, tt.cardID)
})
}
}