You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts
+61-7Lines changed: 61 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -638,10 +638,10 @@ describe('Validate: Overlapping fields can be merged', () => {
638
638
expectErrors(`
639
639
{
640
640
field {
641
-
...F
641
+
...I
642
642
}
643
643
field {
644
-
...I
644
+
...F
645
645
}
646
646
}
647
647
fragment F on T {
@@ -661,14 +661,41 @@ describe('Validate: Overlapping fields can be merged', () => {
661
661
`).toDeepEqual([
662
662
{
663
663
message:
664
-
'Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields and subfields "y" conflict because "c" and "d" are different fields. Use different aliases on the fields to fetch both if this was intentional.',
664
+
'Fields "field" conflict because subfields "y" conflict because "d" and "c" are different fields and subfields "x" conflict because "b" and "a" are different fields. Use different aliases on the fields to fetch both if this was intentional.',
665
665
locations: [
666
666
{line: 3,column: 9},
667
-
{line: 11,column: 9},
668
-
{line: 15,column: 9},
669
-
{line: 6,column: 9},
670
-
{line: 22,column: 9},
671
667
{line: 18,column: 9},
668
+
{line: 22,column: 9},
669
+
{line: 6,column: 9},
670
+
{line: 15,column: 9},
671
+
{line: 11,column: 9},
672
+
],
673
+
},
674
+
]);
675
+
});
676
+
677
+
it('reports deep conflict after nested fragments',()=>{
678
+
expectErrors(`
679
+
fragment F on T {
680
+
...G
681
+
}
682
+
fragment G on T {
683
+
...H
684
+
}
685
+
fragment H on T {
686
+
x: a
687
+
}
688
+
{
689
+
x: b
690
+
...F
691
+
}
692
+
`).toDeepEqual([
693
+
{
694
+
message:
695
+
'Fields "x" conflict because "b" and "a" are different fields. Use different aliases on the fields to fetch both if this was intentional.',
696
+
locations: [
697
+
{line: 12,column: 9},
698
+
{line: 9,column: 9},
672
699
],
673
700
},
674
701
]);
@@ -1265,6 +1292,33 @@ describe('Validate: Overlapping fields can be merged', () => {
1265
1292
]);
1266
1293
});
1267
1294
1295
+
it('does not infinite loop on recursive fragments separated by fields',()=>{
1296
+
expectValid(`
1297
+
{
1298
+
...fragA
1299
+
...fragB
1300
+
}
1301
+
1302
+
fragment fragA on T {
1303
+
x {
1304
+
...fragA
1305
+
x {
1306
+
...fragA
1307
+
}
1308
+
}
1309
+
}
1310
+
1311
+
fragment fragB on T {
1312
+
x {
1313
+
...fragB
1314
+
x {
1315
+
...fragB
1316
+
}
1317
+
}
1318
+
}
1319
+
`);
1320
+
});
1321
+
1268
1322
describe('fragment arguments must produce fields that can be merged',()=>{
1269
1323
it('allows conflicting spreads at different depths',()=>{
0 commit comments