Skip to content

Commit 203043d

Browse files
AaronMoatIvanGoncharov
authored andcommitted
polish: added test from work on v17 branch backported to v16
originally related to: OverlappingFieldsCanBeMergedRule: Fix performance degradation (graphql#3958) Co-authored-by: AaronMoat <AaronMoat@users.noreply.github.com> Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
1 parent 42afa6f commit 203043d

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,24 @@ describe('Validate: Overlapping fields can be merged', () => {
185185
]);
186186
});
187187

188+
it('different args, first has two, second missing one', () => {
189+
expectErrors(`
190+
fragment conflictingArgs on Dog {
191+
doesKnowCommand(dogCommand: SIT, atExpertLevel: true)
192+
doesKnowCommand(dogCommand: SIT)
193+
}
194+
`).toDeepEqual([
195+
{
196+
message:
197+
'Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.',
198+
locations: [
199+
{ line: 3, column: 9 },
200+
{ line: 4, column: 9 },
201+
],
202+
},
203+
]);
204+
});
205+
188206
it('conflicting arg values', () => {
189207
expectErrors(`
190208
fragment conflictingArgs on Dog {

src/validation/rules/OverlappingFieldsCanBeMergedRule.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,8 @@ function sameArguments(
680680
return false;
681681
}
682682

683-
/* c8 ignore next */
684683
if (args1.length !== args2.length) {
685-
/* c8 ignore next */
686684
return false;
687-
/* c8 ignore next */
688685
}
689686

690687
const values2 = new Map(args2.map(({ name, value }) => [name.value, value]));

0 commit comments

Comments
 (0)