forked from WasabiAiR/stow
-
Notifications
You must be signed in to change notification settings - Fork 10
/
stow_test.go
47 lines (40 loc) · 1 KB
/
stow_test.go
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
40
41
42
43
44
45
46
47
package stow_test
import (
"errors"
"net/url"
"testing"
"github.com/cheekybits/is"
"github.com/flyteorg/stow"
)
func TestKindByURL(t *testing.T) {
is := is.New(t)
u, err := url.Parse("test://container/item")
is.NoErr(err)
kind, err := stow.KindByURL(u)
is.NoErr(err)
is.Equal(kind, testKind)
}
func TestKinds(t *testing.T) {
is := is.New(t)
stow.Register("example", nil, nil, nil)
is.Equal(stow.Kinds(), []string{"test", "example"})
}
func TestIsCursorEnd(t *testing.T) {
is := is.New(t)
is.True(stow.IsCursorEnd(""))
is.False(stow.IsCursorEnd("anything"))
}
func TestErrNotSupported(t *testing.T) {
is := is.New(t)
err := errors.New("something")
is.False(stow.IsNotSupported(err))
err = stow.NotSupported("feature")
is.True(stow.IsNotSupported(err))
}
func TestDuplicateKinds(t *testing.T) {
is := is.New(t)
stow.Register("example", nil, nil, nil)
is.Equal(stow.Kinds(), []string{"test", "example"})
stow.Register("example", nil, nil, nil)
is.Equal(stow.Kinds(), []string{"test", "example"})
}