Skip to content

Commit dd30f63

Browse files
committed
elaborated on one test for directives on interfaces
1 parent 88fcd14 commit dd30f63

File tree

1 file changed

+19
-40
lines changed

1 file changed

+19
-40
lines changed

test/analysis/typeComplexityAnalysis.test.ts

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -661,26 +661,6 @@ describe('Test getQueryTypeComplexity function', () => {
661661
expect(queryParser.processQuery(parse(query))).toBe(22);
662662
});
663663

664-
xtest('that include a directive', () => {
665-
query = `
666-
query {
667-
hero(episode: EMPIRE) {
668-
...@include(if: true) {
669-
name
670-
friends(first: 3) {
671-
name
672-
}
673-
}
674-
... on Human {
675-
homePlanet
676-
}
677-
}
678-
}`;
679-
mockCharacterFriendsFunction.mockReturnValueOnce(3);
680-
// Query 1 + 1 hero + max(...Character 3, ...Human 0) = 5
681-
expect(queryParser.processQuery(parse(query))).toBe(5);
682-
});
683-
684664
test('and multiple fragments apply to the selection set', () => {
685665
query = `
686666
query {
@@ -814,7 +794,7 @@ describe('Test getQueryTypeComplexity function', () => {
814794
expect(queryParser.processQuery(parse(query))).toBe(5);
815795
});
816796

817-
xtest('that include a directive', () => {
797+
xtest('that include the "include" directive', () => {
818798
query = `
819799
query {
820800
hero(episode: EMPIRE) {
@@ -832,6 +812,24 @@ describe('Test getQueryTypeComplexity function', () => {
832812
mockCharacterFriendsFunction.mockReturnValueOnce(3);
833813
// Query 1 + 1 hero + max(...Character 3, ...Human 0) = 5
834814
expect(queryParser.processQuery(parse(query))).toBe(5);
815+
816+
query = `
817+
query {
818+
hero(episode: EMPIRE) {
819+
...@include(if: false) {
820+
name
821+
friends(first: 3) {
822+
name
823+
}
824+
}
825+
... on Human {
826+
homePlanet
827+
}
828+
}
829+
}`;
830+
mockCharacterFriendsFunction.mockReturnValueOnce(3);
831+
// Query 1 + 1 hero + max(...Character 3, ...Human 0) = 5
832+
expect(queryParser.processQuery(parse(query))).toBe(2);
835833
});
836834

837835
test('and multiple fragments apply to the selection set', () => {
@@ -1108,25 +1106,6 @@ describe('Test getQueryTypeComplexity function', () => {
11081106
queryParser.processQuery(parse(query));
11091107
expect(queryParser.maxDepth).toBe(3);
11101108
});
1111-
1112-
xtest('with inline fragments that contain an directive', () => {
1113-
query = `
1114-
query {
1115-
hero(episode: EMPIRE) {
1116-
...@include(if: true) {
1117-
name
1118-
friends(first: 3) {
1119-
name
1120-
}
1121-
}
1122-
... on Human {
1123-
homePlanet
1124-
}
1125-
}
1126-
}`;
1127-
queryParser.processQuery(parse(query));
1128-
expect(queryParser.maxDepth).toBe(3);
1129-
});
11301109
});
11311110

11321111
xdescribe('Calculates the correct type complexity for subscriptions', () => {});

0 commit comments

Comments
 (0)