Skip to content

Commit 1d120d0

Browse files
authored
add additional nested fragment test (#8)
1 parent 2d14275 commit 1d120d0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/execution/__tests__/variables-test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,27 @@ describe('Execute: Handles inputs', () => {
14391439
});
14401440
});
14411441

1442+
it('when argument variables with the same name are used directly and recursively', () => {
1443+
const result = executeQueryWithFragmentArguments(`
1444+
query {
1445+
...a(value: "A")
1446+
}
1447+
fragment a($value: String!) on TestType {
1448+
...b(value: "B")
1449+
fieldInFragmentA: fieldWithNonNullableStringInput(input: $value)
1450+
}
1451+
fragment b($value: String!) on TestType {
1452+
fieldInFragmentB: fieldWithNonNullableStringInput(input: $value)
1453+
}
1454+
`);
1455+
expect(result).to.deep.equal({
1456+
data: {
1457+
fieldInFragmentA: '"A"',
1458+
fieldInFragmentB: '"B"',
1459+
},
1460+
});
1461+
});
1462+
14421463
it('when argument passed in as list', () => {
14431464
const result = executeQueryWithFragmentArguments(`
14441465
query Q($opValue: String = "op") {

0 commit comments

Comments
 (0)