Skip to content

Commit 55e568a

Browse files
committed
Merge branch 'dev' of github.com:oslabs-beta/GraphQL-Gate into sh/fragments
2 parents 5d2568d + 39dc915 commit 55e568a

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

test/analysis/buildTypeWeights.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ describe('Test buildTypeWeightsFromSchema function', () => {
550550
isHero: {
551551
weight: 0,
552552
},
553+
droids: {
554+
resolveTo: 'droid',
555+
},
556+
episode: {
557+
resolveTo: 'episode',
558+
},
553559
},
554560
},
555561
droid: {
@@ -560,6 +566,10 @@ describe('Test buildTypeWeightsFromSchema function', () => {
560566
},
561567
},
562568
},
569+
episode: {
570+
weight: 0,
571+
fields: {},
572+
},
563573
});
564574
});
565575

@@ -600,10 +610,6 @@ describe('Test buildTypeWeightsFromSchema function', () => {
600610
},
601611
},
602612
},
603-
episode: {
604-
weight: 0,
605-
fields: {},
606-
},
607613
});
608614
});
609615
});

test/analysis/typeComplexityAnalysis.test.ts

Lines changed: 10 additions & 2 deletions
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
515-
mockHumanFriendsFunction.mockReturnValueOnce(3);
517+
// Query 1 + 1 hero + max(Droid 2, Human 3) = 5
518+
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)