Skip to content

Commit 762c0f9

Browse files
kittenJoviDeCroock
authored andcommitted
Add test for non-const variable argument on spreads
1 parent 6a6e2ae commit 762c0f9

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
@@ -233,29 +233,44 @@ describe('parse', () => {
233233
});
234234

235235
it('parses fragment spread arguments', () => {
236-
expect(
237-
parse('query x { ...x(var: 2) } fragment x($var: Int = 1) on Type { field }').definitions[0]
238-
).toHaveProperty('selectionSet.selections.0', {
239-
kind: Kind.FRAGMENT_SPREAD,
240-
directives: undefined,
241-
name: {
242-
kind: Kind.NAME,
243-
value: 'x',
244-
},
245-
arguments: [
246-
{
247-
kind: 'Argument',
248-
name: {
249-
kind: 'Name',
250-
value: 'var',
236+
expect(parse('query x { ...x(varA: 2, varB: $var) }').definitions[0]).toHaveProperty(
237+
'selectionSet.selections.0',
238+
{
239+
kind: Kind.FRAGMENT_SPREAD,
240+
directives: undefined,
241+
name: {
242+
kind: Kind.NAME,
243+
value: 'x',
244+
},
245+
arguments: [
246+
{
247+
kind: 'Argument',
248+
name: {
249+
kind: 'Name',
250+
value: 'varA',
251+
},
252+
value: {
253+
kind: 'IntValue',
254+
value: '2',
255+
},
251256
},
252-
value: {
253-
kind: 'IntValue',
254-
value: '2',
257+
{
258+
kind: 'Argument',
259+
name: {
260+
kind: 'Name',
261+
value: 'varB',
262+
},
263+
value: {
264+
kind: 'Variable',
265+
name: {
266+
kind: 'Name',
267+
value: 'var',
268+
},
269+
},
255270
},
256-
},
257-
],
258-
});
271+
],
272+
}
273+
);
259274
});
260275

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

0 commit comments

Comments
 (0)