forked from project-safari/zebra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeta_test.go
More file actions
35 lines (24 loc) · 722 Bytes
/
Copy pathmeta_test.go
File metadata and controls
35 lines (24 loc) · 722 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
package zebra_test
import (
"testing"
"github.com/project-safari/zebra"
"github.com/stretchr/testify/assert"
)
func TestMetaValidate(t *testing.T) {
t.Parallel()
assert := assert.New(t)
m := zebra.Meta{}
assert.Equal(zebra.ErrIDEmpty, m.Validate())
m.ID = "ab"
assert.Equal(zebra.ErrIDShort, m.Validate())
m.ID = "abcdefgh"
assert.Equal(zebra.ErrNameEmpty, m.Validate())
m.Name = "mock"
assert.NotNil(m.Validate())
m.Type = zebra.Type{Name: "dummy", Description: "dummy"}
assert.Equal(zebra.ErrLabel, m.Validate())
m = zebra.NewMeta(m.Type, "test_meta", "test_group", "test_owner")
assert.Nil(m.Validate())
m = zebra.NewMeta(m.Type, "", "test_group", "test_owner")
assert.Nil(m.Validate())
}