@@ -75,6 +75,16 @@ func TestValidate_KnownArgumentNames_UndirectiveArgsAreInvalid(t *testing.T) {
75
75
testutil .RuleError (`Unknown argument "unless" on directive "@skip".` , 3 , 19 ),
76
76
})
77
77
}
78
+ func TestValidate_KnownArgumentNames_UndirectiveArgsAreInvalidWithSuggestion (t * testing.T ) {
79
+ testutil .ExpectFailsRule (t , graphql .KnownArgumentNamesRule , `
80
+ {
81
+ dog @skip(of: true)
82
+ }
83
+ ` , []gqlerrors.FormattedError {
84
+ testutil .RuleError (`Unknown argument "of" on directive "@skip". ` +
85
+ `Did you mean "if"?` , 3 , 19 ),
86
+ })
87
+ }
78
88
func TestValidate_KnownArgumentNames_InvalidArgName (t * testing.T ) {
79
89
testutil .ExpectFailsRule (t , graphql .KnownArgumentNamesRule , `
80
90
fragment invalidArgName on Dog {
@@ -94,6 +104,16 @@ func TestValidate_KnownArgumentNames_UnknownArgsAmongstKnownArgs(t *testing.T) {
94
104
testutil .RuleError (`Unknown argument "unknown" on field "doesKnowCommand" of type "Dog".` , 3 , 55 ),
95
105
})
96
106
}
107
+ func TestValidate_KnownArgumentNames_UnknownArgsAmongstKnownArgsWithSuggestions (t * testing.T ) {
108
+ testutil .ExpectFailsRule (t , graphql .KnownArgumentNamesRule , `
109
+ fragment oneGoodArgOneInvalidArg on Dog {
110
+ doesKnowCommand(ddogCommand: SIT,)
111
+ }
112
+ ` , []gqlerrors.FormattedError {
113
+ testutil .RuleError (`Unknown argument "ddogCommand" on field "doesKnowCommand" of type "Dog". ` +
114
+ `Did you mean "dogCommand"?` , 3 , 25 ),
115
+ })
116
+ }
97
117
func TestValidate_KnownArgumentNames_UnknownArgsDeeply (t * testing.T ) {
98
118
testutil .ExpectFailsRule (t , graphql .KnownArgumentNamesRule , `
99
119
{
0 commit comments