Skip to content

Commit 1881e0f

Browse files
committed
Add tests
1 parent a6cb5cd commit 1881e0f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/utilities/__tests__/getIntrospectionQuery-test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,10 @@ describe('getIntrospectionQuery', () => {
138138
2,
139139
);
140140
});
141+
142+
it('throw error if typeDepth is too high', () => {
143+
expect(() => getIntrospectionQuery({ typeDepth: 101 })).to.throw(
144+
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
145+
);
146+
});
141147
});

src/utilities/getIntrospectionQuery.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
8686
return '';
8787
}
8888
if (level > 100) {
89-
throw new Error('Please set typeDepth to a reasonable value; the default is 9.');
89+
throw new Error(
90+
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
91+
);
9092
}
9193
return `
9294
${indent}ofType {

0 commit comments

Comments
 (0)