Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/language/__tests__/parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ describe('Parser', () => {
`);
});

it('limit maximum number of tokens', () => {
it('limits by a maximum number of tokens', () => {
expect(() => parse('{ foo }', { maxTokens: 3 })).to.not.throw();
expect(() => parse('{ foo }', { maxTokens: 2 })).to.throw(
'Syntax Error: Document contains more that 2 tokens. Parsing aborted.',
'Syntax Error: Document contains more than 2 tokens. Parsing aborted.',
);

expect(() => parse('{ foo(bar: "baz") }', { maxTokens: 8 })).to.not.throw();

expect(() => parse('{ foo(bar: "baz") }', { maxTokens: 7 })).to.throw(
'Syntax Error: Document contains more that 7 tokens. Parsing aborted.',
'Syntax Error: Document contains more than 7 tokens. Parsing aborted.',
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/language/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ export class Parser {
throw syntaxError(
this._lexer.source,
token.start,
`Document contains more that ${maxTokens} tokens. Parsing aborted.`,
`Document contains more than ${maxTokens} tokens. Parsing aborted.`,
);
}
}
Expand Down