Skip to content

Commit ae75d67

Browse files
Nols1000yaacovCR
authored andcommitted
Add tests
1 parent f508c35 commit ae75d67

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/utilities/__tests__/getIntrospectionQuery-test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,10 @@ describe('getIntrospectionQuery', () => {
176176
.toNotContain('directives(includeDeprecated: true) {')
177177
.toMatch('deprecationReason', 2);
178178
});
179+
180+
it('throw error if typeDepth is too high', () => {
181+
expect(() => getIntrospectionQuery({ typeDepth: 101 })).to.throw(
182+
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
183+
);
184+
});
179185
});

src/utilities/getIntrospectionQuery.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
9696
return '';
9797
}
9898
if (level > 100) {
99-
throw new Error('Please set typeDepth to a reasonable value; the default is 9.');
99+
throw new Error(
100+
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
101+
);
100102
}
101103
return `
102104
${indent}ofType {

0 commit comments

Comments
 (0)