mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 00:09:51 +02:00
feat: add use case diagram examples and update parser tests for error handling
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -1489,14 +1489,18 @@ describe('Error Handling', () => {
|
||||
const emptyInput = '';
|
||||
|
||||
expect(() => parseUsecaseWithAntlr(emptyInput)).toThrow(UsecaseParseError);
|
||||
expect(() => parseUsecaseWithAntlr(emptyInput)).toThrow(/missing 'usecase'/);
|
||||
expect(() => parseUsecaseWithAntlr(emptyInput)).toThrow(
|
||||
/mismatched input '<EOF>' expecting {'usecase', NEWLINE}/
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw UsecaseParseError for only whitespace input', () => {
|
||||
const whitespaceInput = ' \n \t \n ';
|
||||
|
||||
expect(() => parseUsecaseWithAntlr(whitespaceInput)).toThrow(UsecaseParseError);
|
||||
expect(() => parseUsecaseWithAntlr(whitespaceInput)).toThrow(/missing 'usecase'/);
|
||||
expect(() => parseUsecaseWithAntlr(whitespaceInput)).toThrow(
|
||||
/extraneous input '<EOF>' expecting {'usecase', NEWLINE}/
|
||||
);
|
||||
});
|
||||
|
||||
it('should throw UsecaseParseError for missing usecase keyword', () => {
|
||||
@@ -1506,7 +1510,9 @@ describe('Error Handling', () => {
|
||||
`;
|
||||
|
||||
expect(() => parseUsecaseWithAntlr(missingKeyword)).toThrow(UsecaseParseError);
|
||||
expect(() => parseUsecaseWithAntlr(missingKeyword)).toThrow(/missing 'usecase'/);
|
||||
expect(() => parseUsecaseWithAntlr(missingKeyword)).toThrow(
|
||||
/extraneous input 'actor' expecting {'usecase', NEWLINE}/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user