-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombinator_test.go
67 lines (62 loc) · 1.47 KB
/
combinator_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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package kosmo
import (
"testing"
"github.com/graphql-go/graphql"
. "github.com/smartystreets/goconvey/convey"
)
func TestCombineObjectConfig(t *testing.T) {
Convey("Given multiple graphql.ObjectConfig's", t, func() {
config1 := graphql.ObjectConfig{
Name: "Name1",
Fields: graphql.Fields{
"Test1": &graphql.Field{
Name: "Test1",
},
"Test2": &graphql.Field{
Name: "Test2",
},
},
}
config2 := graphql.ObjectConfig{
Name: "Name1",
Fields: graphql.Fields{
"Test3": &graphql.Field{
Name: "Test3",
},
"Test4": &graphql.Field{
Name: "Test4",
},
"Test5": &graphql.Field{
Name: "Test5",
},
},
}
config3 := graphql.ObjectConfig{
Name: "Name1",
Fields: nil,
}
config4 := graphql.ObjectConfig{
Name: "Name1",
Fields: graphql.Fields{
"Test6": &graphql.Field{
Name: "Test3",
},
"Test7": nil,
},
}
combinedConfig := combineObjectConfig(config1, config2, config3, config4)
Convey("The graphql.ObjectConfig returned should contain all the fields of the passed in configs", func() {
fields := combinedConfig.Fields.(graphql.Fields)
_, firstIsOk := fields["Test1"]
_, secondIsOk := fields["Test2"]
_, thirdIsOk := fields["Test3"]
_, fourthIsOk := fields["Test4"]
_, fifthIsOk := fields["Test5"]
So(firstIsOk, ShouldBeTrue)
So(secondIsOk, ShouldBeTrue)
So(thirdIsOk, ShouldBeTrue)
So(fourthIsOk, ShouldBeTrue)
So(fifthIsOk, ShouldBeTrue)
})
})
}