Skip to content

Commit bcb3b6d

Browse files
committed
updated differing complexity tests for inline fragments so both fragments have a complexity > 0
1 parent 77d99ee commit bcb3b6d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/analysis/typeComplexityAnalysis.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ describe('Test getQueryTypeComplexity function', () => {
502502
name
503503
... on Droid {
504504
primaryFunction
505+
friends(first: 1) {
506+
name
507+
}
505508
}
506509
... on Human {
507510
homePlanet
@@ -511,8 +514,9 @@ describe('Test getQueryTypeComplexity function', () => {
511514
}
512515
}
513516
}`;
514-
// Query 1 + 1 hero + max(Droid 0, Human 3) = 5
517+
// Query 1 + 1 hero + max(Droid 2, Human 3) = 5
515518
mockCharacterFriendsFunction.mockReturnValueOnce(3);
519+
mockDroidFriendsFunction.mockReturnValueOnce(1);
516520
expect(getQueryTypeComplexity(parse(query), variables, unionTypeWeights)).toBe(
517521
5
518522
);
@@ -655,6 +659,9 @@ describe('Test getQueryTypeComplexity function', () => {
655659
name
656660
... on Droid {
657661
primaryFunction
662+
friends(first: 2) {
663+
name
664+
}
658665
}
659666
... on Human {
660667
homePlanet
@@ -666,6 +673,7 @@ describe('Test getQueryTypeComplexity function', () => {
666673
}`;
667674
// Query 1 + 1 hero + max(Droid 0, Human 3) = 5
668675
mockHumanFriendsFunction.mockReturnValueOnce(3);
676+
mockDroidFriendsFunction.mockReturnValueOnce(2);
669677
expect(getQueryTypeComplexity(parse(query), variables, typeWeights)).toBe(5);
670678
});
671679

0 commit comments

Comments
 (0)