Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nols1000 committed Jan 12, 2025
1 parent a6cb5cd commit 1881e0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/utilities/__tests__/getIntrospectionQuery-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,10 @@ describe('getIntrospectionQuery', () => {
2,
);
});

it('throw error if typeDepth is too high', () => {
expect(() => getIntrospectionQuery({ typeDepth: 101 })).to.throw(
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
);
});
});
4 changes: 3 additions & 1 deletion src/utilities/getIntrospectionQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
return '';
}
if (level > 100) {
throw new Error('Please set typeDepth to a reasonable value; the default is 9.');
throw new Error(
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
);
}
return `
${indent}ofType {
Expand Down

0 comments on commit 1881e0f

Please sign in to comment.