Skip to content

Commit

Permalink
Fix typo in the error message for max tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Sep 22, 2022
1 parent 269d6aa commit 523bcf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 523bcf1

Please sign in to comment.