@@ -177,15 +177,14 @@ describe('Validate: Variables are in allowed positions', () => {
177
177
178
178
it ( 'Int => Int!' , ( ) => {
179
179
expectFailsRule ( VariablesInAllowedPosition , `
180
- query Query($intArg: Int)
181
- {
180
+ query Query($intArg: Int) {
182
181
complicatedArgs {
183
182
nonNullIntArgField(nonNullIntArg: $intArg)
184
183
}
185
184
}
186
185
` , [
187
186
{ message : badVarPosMessage ( 'intArg' , 'Int' , 'Int!' ) ,
188
- locations : [ { line : 5 , column : 45 } ] }
187
+ locations : [ { line : 4 , column : 45 } , { line : 2 , column : 19 } ] } ,
189
188
] ) ;
190
189
} ) ;
191
190
@@ -195,15 +194,14 @@ describe('Validate: Variables are in allowed positions', () => {
195
194
nonNullIntArgField(nonNullIntArg: $intArg)
196
195
}
197
196
198
- query Query($intArg: Int)
199
- {
197
+ query Query($intArg: Int) {
200
198
complicatedArgs {
201
199
...nonNullIntArgFieldFrag
202
200
}
203
201
}
204
202
` , [
205
203
{ message : badVarPosMessage ( 'intArg' , 'Int' , 'Int!' ) ,
206
- locations : [ { line : 3 , column : 43 } ] }
204
+ locations : [ { line : 3 , column : 43 } , { line : 6 , column : 19 } ] }
207
205
] ) ;
208
206
} ) ;
209
207
@@ -217,67 +215,62 @@ describe('Validate: Variables are in allowed positions', () => {
217
215
nonNullIntArgField(nonNullIntArg: $intArg)
218
216
}
219
217
220
- query Query($intArg: Int)
221
- {
218
+ query Query($intArg: Int) {
222
219
complicatedArgs {
223
220
...outerFrag
224
221
}
225
222
}
226
223
` , [
227
224
{ message : badVarPosMessage ( 'intArg' , 'Int' , 'Int!' ) ,
228
- locations : [ { line : 7 , column : 43 } ] }
225
+ locations : [ { line : 7 , column : 43 } , { line : 10 , column : 19 } ] }
229
226
] ) ;
230
227
} ) ;
231
228
232
229
it ( 'String over Boolean' , ( ) => {
233
230
expectFailsRule ( VariablesInAllowedPosition , `
234
- query Query($stringVar: String)
235
- {
231
+ query Query($stringVar: String) {
236
232
complicatedArgs {
237
233
booleanArgField(booleanArg: $stringVar)
238
234
}
239
235
}
240
236
` , [
241
237
{ message : badVarPosMessage ( 'stringVar' , 'String' , 'Boolean' ) ,
242
- locations : [ { line : 5 , column : 39 } ] }
238
+ locations : [ { line : 4 , column : 39 } , { line : 2 , column : 19 } ] }
243
239
] ) ;
244
240
} ) ;
245
241
246
242
it ( 'String => [String]' , ( ) => {
247
243
expectFailsRule ( VariablesInAllowedPosition , `
248
- query Query($stringVar: String)
249
- {
244
+ query Query($stringVar: String) {
250
245
complicatedArgs {
251
246
stringListArgField(stringListArg: $stringVar)
252
247
}
253
248
}
254
249
` , [
255
250
{ message : badVarPosMessage ( 'stringVar' , 'String' , '[String]' ) ,
256
- locations : [ { line : 5 , column : 45 } ] }
251
+ locations : [ { line : 4 , column : 45 } , { line : 2 , column : 19 } ] }
257
252
] ) ;
258
253
} ) ;
259
254
260
255
it ( 'Boolean => Boolean! in directive' , ( ) => {
261
256
expectFailsRule ( VariablesInAllowedPosition , `
262
- query Query($boolVar: Boolean)
263
- {
257
+ query Query($boolVar: Boolean) {
264
258
dog @include(if: $boolVar)
265
259
}
266
260
` , [
267
261
{ message : badVarPosMessage ( 'boolVar' , 'Boolean' , 'Boolean!' ) ,
268
- locations : [ { line : 4 , column : 26 } ] }
262
+ locations : [ { line : 3 , column : 26 } , { line : 2 , column : 19 } ] }
269
263
] ) ;
270
264
} ) ;
271
265
272
266
it ( 'String => Boolean! in directive' , ( ) => {
273
267
expectFailsRule ( VariablesInAllowedPosition , `
274
- query Query($stringVar: String)
275
- {
268
+ query Query($stringVar: String) {
276
269
dog @include(if: $stringVar)
277
270
}
278
271
` , [
279
272
{ message : badVarPosMessage ( 'stringVar' , 'String' , 'Boolean!' ) ,
280
- locations : [ { line : 4 , column : 26 } ] }
273
+ locations : [ { line : 3 , column : 26 } , { line : 2 , column : 19 } ] }
281
274
] ) ;
282
275
} ) ;
283
276
0 commit comments