Skip to content

Commit 80eb7f0

Browse files
committed
Add test for non-const variable argument on spreads
1 parent 198bbdc commit 80eb7f0

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
@@ -193,29 +193,44 @@ describe('parse', () => {
193193
});
194194

195195
it('parses fragment spread arguments', () => {
196-
expect(
197-
parse('query x { ...x(var: 2) } fragment x($var: Int = 1) on Type { field }').definitions[0]
198-
).toHaveProperty('selectionSet.selections.0', {
199-
kind: Kind.FRAGMENT_SPREAD,
200-
directives: undefined,
201-
name: {
202-
kind: Kind.NAME,
203-
value: 'x',
204-
},
205-
arguments: [
206-
{
207-
kind: 'Argument',
208-
name: {
209-
kind: 'Name',
210-
value: 'var',
196+
expect(parse('query x { ...x(varA: 2, varB: $var) }').definitions[0]).toHaveProperty(
197+
'selectionSet.selections.0',
198+
{
199+
kind: Kind.FRAGMENT_SPREAD,
200+
directives: undefined,
201+
name: {
202+
kind: Kind.NAME,
203+
value: 'x',
204+
},
205+
arguments: [
206+
{
207+
kind: 'Argument',
208+
name: {
209+
kind: 'Name',
210+
value: 'varA',
211+
},
212+
value: {
213+
kind: 'IntValue',
214+
value: '2',
215+
},
211216
},
212-
value: {
213-
kind: 'IntValue',
214-
value: '2',
217+
{
218+
kind: 'Argument',
219+
name: {
220+
kind: 'Name',
221+
value: 'varB',
222+
},
223+
value: {
224+
kind: 'Variable',
225+
name: {
226+
kind: 'Name',
227+
value: 'var',
228+
},
229+
},
215230
},
216-
},
217-
],
218-
});
231+
],
232+
}
233+
);
219234
});
220235

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

0 commit comments

Comments
 (0)