File tree 1 file changed +27
-5
lines changed 1 file changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ import (
10
10
)
11
11
12
12
type T struct {
13
- Query string
14
- Schema graphql.Schema
15
- Expected interface {}
13
+ Query string
14
+ Schema graphql.Schema
15
+ Expected interface {}
16
+ Variables map [string ]interface {}
16
17
}
17
18
18
19
var Tests = []T {}
@@ -69,14 +70,35 @@ func init() {
69
70
},
70
71
},
71
72
},
73
+ {
74
+ Query : `
75
+ query HumanByIdQuery($id: String!) {
76
+ human(id: $id) {
77
+ name
78
+ }
79
+ }
80
+ ` ,
81
+ Schema : testutil .StarWarsSchema ,
82
+ Expected : & graphql.Result {
83
+ Data : map [string ]interface {}{
84
+ "human" : map [string ]interface {}{
85
+ "name" : "Darth Vader" ,
86
+ },
87
+ },
88
+ },
89
+ Variables : map [string ]interface {}{
90
+ "id" : "1001" ,
91
+ },
92
+ },
72
93
}
73
94
}
74
95
75
96
func TestQuery (t * testing.T ) {
76
97
for _ , test := range Tests {
77
98
params := graphql.Params {
78
- Schema : test .Schema ,
79
- RequestString : test .Query ,
99
+ Schema : test .Schema ,
100
+ RequestString : test .Query ,
101
+ VariableValues : test .Variables ,
80
102
}
81
103
testGraphql (test , params , t )
82
104
}
You can’t perform that action at this time.
0 commit comments