-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlivestream_sort_enum_test.go
More file actions
39 lines (33 loc) · 934 Bytes
/
livestream_sort_enum_test.go
File metadata and controls
39 lines (33 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gokick_test
import (
"fmt"
"testing"
"github.com/scorfly/gokick"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewLivestreamSortError(t *testing.T) {
testCases := map[string]string{
"empty": "",
"not supported": "not supported",
}
for name, value := range testCases {
t.Run(name, func(t *testing.T) {
_, err := gokick.NewLivestreamSort(value)
assert.EqualError(t, err, fmt.Sprintf("unknown livestream sort: %s", value))
})
}
}
func TestNewLivestreamSortSuccess(t *testing.T) {
testCases := map[string]gokick.LivestreamSort{
"viewer_count": gokick.LivestreamSortViewerCount,
"started_at": gokick.LivestreamSortStartedAt,
}
for name, value := range testCases {
t.Run(name, func(t *testing.T) {
LivestreamSort, err := gokick.NewLivestreamSort(value.String())
require.NoError(t, err)
assert.Equal(t, LivestreamSort, value)
})
}
}