feat: format and add test
This commit is contained in:
28
client/series_test.go
Normal file
28
client/series_test.go
Normal 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)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user