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
+59
Original file line number
Diff line number
Diff line change
@@ -1246,4 +1246,63 @@ describe('Validate: Overlapping fields can be merged', () => {
1246
1246
},
1247
1247
]);
1248
1248
});
1249
+
1250
+
describe('fragment arguments must produce fields that can be merged',()=>{
1251
+
it('encounters conflict in fragments',()=>{
1252
+
expectErrors(`
1253
+
{
1254
+
...WithArgs(x: 3)
1255
+
...WithArgs(x: 4)
1256
+
}
1257
+
fragment WithArgs($x: Int) on Type {
1258
+
a(x: $x)
1259
+
}
1260
+
`).toDeepEqual([
1261
+
{
1262
+
message:
1263
+
'Spreads "WithArgs" conflict because WithArgs(x: 3) and WithArgs(x: 4) have different fragment arguments.',
1264
+
locations: [
1265
+
{line: 3,column: 11},
1266
+
{line: 4,column: 11},
1267
+
],
1268
+
},
1269
+
]);
1270
+
});
1271
+
it('encounters nested conflict in fragments',()=>{
1272
+
expectErrors(`
1273
+
{
1274
+
connection {
1275
+
edges {
1276
+
...WithArgs(x: 3)
1277
+
}
1278
+
}
1279
+
...Connection
1280
+
}
1281
+
1282
+
fragment Connection on Type {
1283
+
connection {
1284
+
edges {
1285
+
...WithArgs(x: 4)
1286
+
}
1287
+
}
1288
+
}
1289
+
fragment WithArgs($x: Int) on Type {
1290
+
a(x: $x)
1291
+
}
1292
+
`).toDeepEqual([
1293
+
{
1294
+
message:
1295
+
'Fields "connection" conflict because subfields "edges" conflict because child spreads "WithArgs" conflict because WithArgs(x: 3) and WithArgs(x: 4) have different fragment arguments. Use different aliases on the fields to fetch both if this was intentional.',
0 commit comments