-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_test.go
36 lines (33 loc) · 1.1 KB
/
config_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
package kosmo
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestParseTagConfig(t *testing.T) {
Convey("Given a string", t, func() {
config1 := parseTagConfig("require,otherStuff, stuff, ignore")
Convey("It should parse the string to a TagConfig an ignore all values that are not supported", func() {
So(config1.Ignore, ShouldBeTrue)
So(config1.Require, ShouldBeTrue)
})
config2 := parseTagConfig("")
Convey("It should also work if the string is empty", func() {
So(config2.Ignore, ShouldBeFalse)
So(config2.Require, ShouldBeFalse)
})
config3 := parseTagConfig("require")
Convey("And if only one viable flag is included", func() {
So(config3.Ignore, ShouldBeFalse)
So(config3.Require, ShouldBeTrue)
})
config4 := parseTagConfig("required")
Convey("Should also work if require is provided as simple past", func() {
So(config4.Ignore, ShouldBeFalse)
So(config4.Require, ShouldBeTrue)
})
config5 := parseTagConfig("ignored")
Convey("Should also work if ignore is provided as simple past", func() {
So(config5.Ignore, ShouldBeTrue)
})
})
}