mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
20 lines
543 B
TypeScript
20 lines
543 B
TypeScript
|
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();
|
||
|
}
|