mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-14 21:09:50 +02:00
create noErrorsOrAlternatives
parser helper function
This commit is contained in:
19
packages/parser/tests/test-util.ts
Normal file
19
packages/parser/tests/test-util.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { ParseResult } from 'langium';
|
||||
|
||||
const consoleMock = vi.spyOn(console, 'log').mockImplementation(() => {
|
||||
return;
|
||||
});
|
||||
|
||||
/**
|
||||
* A helper test function that validate that the result doesn't have errors
|
||||
* or any ambiguous alternatives from chevrotain.
|
||||
*
|
||||
* @param result - the result `parse` function.
|
||||
*/
|
||||
export function noErrorsOrAlternatives(result: ParseResult) {
|
||||
expect(result.lexerErrors).toHaveLength(0);
|
||||
expect(result.parserErrors).toHaveLength(0);
|
||||
|
||||
expect(consoleMock).not.toHaveBeenCalled();
|
||||
consoleMock.mockReset();
|
||||
}
|
Reference in New Issue
Block a user