File tree Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Expand file tree Collapse file tree 1 file changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,10 @@ import (
1010)
1111
1212type 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 {}
1617}
1718
1819var Tests = []T {}
@@ -69,14 +70,35 @@ func init() {
6970 },
7071 },
7172 },
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+ },
7293 }
7394}
7495
7596func TestQuery (t * testing.T ) {
7697 for _ , test := range Tests {
7798 params := graphql.Params {
78- Schema : test .Schema ,
79- RequestString : test .Query ,
99+ Schema : test .Schema ,
100+ RequestString : test .Query ,
101+ VariableValues : test .Variables ,
80102 }
81103 testGraphql (test , params , t )
82104 }
You can’t perform that action at this time.
0 commit comments