File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,3 +139,31 @@ func TestNoUnusedVariables(t *testing.T) {
139139 require .Nil (t , validator .Validate (s , q ))
140140 })
141141}
142+
143+ func TestValidateOptionDisableSuggestion (t * testing.T ) {
144+ s := gqlparser .MustLoadSchema (& ast.Source {Name : "graph/schema.graphqls" , Input : `
145+ extend type User {
146+ id: ID!
147+ }
148+
149+ extend type Query {
150+ user: User!
151+ }
152+ ` , BuiltIn : false },
153+ )
154+
155+ q , err := parser .ParseQuery (& ast.Source {Name : "ff" , Input : `{
156+ user {
157+ idd
158+ }
159+ }` })
160+
161+ r := validator .Validate (s , q )
162+ require .NoError (t , err )
163+ require .Len (t , r , 1 )
164+ require .EqualError (t , r [0 ], `ff:3: Cannot query field "idd" on type "User". Did you mean "id"?` )
165+
166+ r = validator .Validate (s , q , validator.DisableSuggestion {})
167+ require .Len (t , r , 1 )
168+ require .EqualError (t , r [0 ], `ff:3: Cannot query field "idd" on type "User".` )
169+ }
You can’t perform that action at this time.
0 commit comments