Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,33 @@ describe('Validate: Overlapping fields can be merged', () => {
]);
});

it('reports deep conflict after nested fragments', () => {
expectErrors(`
fragment F on T {
...G
}
fragment G on T {
...H
}
fragment H on T {
x: a
}
{
x: b
...F
}
`).toDeepEqual([
{
message:
'Fields "x" conflict because "b" and "a" are different fields. Use different aliases on the fields to fetch both if this was intentional.',
locations: [
{ line: 12, column: 9 },
{ line: 9, column: 9 },
],
},
]);
});

it('ignores unknown fragments', () => {
expectValid(`
{
Expand Down Expand Up @@ -1138,4 +1165,31 @@ describe('Validate: Overlapping fields can be merged', () => {
},
]);
});

it('does not infinite loop on recursive fragments separated by fields', () => {
expectValid(`
{
...fragA
...fragB
}

fragment fragA on T {
x {
...fragA
x {
...fragA
}
}
}

fragment fragB on T {
x {
...fragB
x {
...fragB
}
}
}
`);
});
});
Loading
Loading