mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
24d43849a0
* pref: optimize `common` rules and matchers * chore: rename diagrams services to short form * chore: sort imports
19 lines
581 B
TypeScript
19 lines
581 B
TypeScript
import type { ParseResult } from 'langium';
|
|
import { expect, vi } from 'vitest';
|
|
|
|
const consoleMock = vi.spyOn(console, 'log').mockImplementation(() => undefined);
|
|
|
|
/**
|
|
* 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();
|
|
}
|