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/series_test.go Normal file
View File

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