Skip to content

Commit f1dc151

Browse files
kittenJoviDeCroock
authored andcommitted
Add test for non-const variable argument on spreads
1 parent 37e7381 commit f1dc151

File tree

1 file changed

+36
-21
lines changed

1 file changed

+36
-21
lines changed

src/__tests__/parser.test.ts

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -225,29 +225,44 @@ describe('parse', () => {
225225
});
226226

227227
it('parses fragment spread arguments', () => {
228-
expect(
229-
parse('query x { ...x(var: 2) } fragment x($var: Int = 1) on Type { field }').definitions[0]
230-
).toHaveProperty('selectionSet.selections.0', {
231-
kind: Kind.FRAGMENT_SPREAD,
232-
directives: undefined,
233-
name: {
234-
kind: Kind.NAME,
235-
value: 'x',
236-
},
237-
arguments: [
238-
{
239-
kind: 'Argument',
240-
name: {
241-
kind: 'Name',
242-
value: 'var',
228+
expect(parse('query x { ...x(varA: 2, varB: $var) }').definitions[0]).toHaveProperty(
229+
'selectionSet.selections.0',
230+
{
231+
kind: Kind.FRAGMENT_SPREAD,
232+
directives: undefined,
233+
name: {
234+
kind: Kind.NAME,
235+
value: 'x',
236+
},
237+
arguments: [
238+
{
239+
kind: 'Argument',
240+
name: {
241+
kind: 'Name',
242+
value: 'varA',
243+
},
244+
value: {
245+
kind: 'IntValue',
246+
value: '2',
247+
},
243248
},
244-
value: {
245-
kind: 'IntValue',
246-
value: '2',
249+
{
250+
kind: 'Argument',
251+
name: {
252+
kind: 'Name',
253+
value: 'varB',
254+
},
255+
value: {
256+
kind: 'Variable',
257+
name: {
258+
kind: 'Name',
259+
value: 'var',
260+
},
261+
},
247262
},
248-
},
249-
],
250-
});
263+
],
264+
}
265+
);
251266
});
252267

253268
it('parses fields', () => {

0 commit comments

Comments
 (0)