mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 14:29:25 +02:00
chore: Update error snapshots
This commit is contained in:
@@ -53,7 +53,7 @@ describe('diagram-orchestration', () => {
|
||||
expect(() =>
|
||||
detectType('flowchart TD; A-->B', { flowchart: { defaultRenderer: 'dagre-d3' } })
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: flowchart TD; A-->B"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: flowchart TD; A-->B]`
|
||||
);
|
||||
|
||||
// graph & dagre-wrapper => flowchart-v2
|
||||
|
@@ -17,16 +17,16 @@ describe('DiagramAPI', () => {
|
||||
|
||||
it('should throw error if diagram is not defined', () => {
|
||||
expect(() => getDiagram('loki')).toThrowErrorMatchingInlineSnapshot(
|
||||
'"Diagram loki not found."'
|
||||
`[Error: Diagram loki not found.]`
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle diagram registrations', () => {
|
||||
expect(() => getDiagram('loki')).toThrowErrorMatchingInlineSnapshot(
|
||||
'"Diagram loki not found."'
|
||||
`[Error: Diagram loki not found.]`
|
||||
);
|
||||
expect(() => detectType('loki diagram')).toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: loki diagram"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: loki diagram]`
|
||||
);
|
||||
const detector: DiagramDetector = (str: string) => {
|
||||
return str.match('loki') !== null;
|
||||
|
@@ -65,23 +65,23 @@ describe('diagram detection', () => {
|
||||
|
||||
test('should throw the right error for incorrect diagram', async () => {
|
||||
await expect(Diagram.fromText('graph TD; A-->')).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Parse error on line 2:
|
||||
[Error: Parse error on line 2:
|
||||
graph TD; A-->
|
||||
--------------^
|
||||
Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'EOF'"
|
||||
Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'EOF']
|
||||
`);
|
||||
await expect(Diagram.fromText('sequenceDiagram; A-->B')).rejects
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Parse error on line 1:
|
||||
...quenceDiagram; A-->B
|
||||
-----------------------^
|
||||
Expecting 'TXT', got 'NEWLINE'"
|
||||
`);
|
||||
[Error: Parse error on line 1:
|
||||
...quenceDiagram; A-->B
|
||||
-----------------------^
|
||||
Expecting 'TXT', got 'NEWLINE']
|
||||
`);
|
||||
});
|
||||
|
||||
test('should throw the right error for unregistered diagrams', async () => {
|
||||
await expect(Diagram.fromText('thor TD; A-->B')).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: thor TD; A-->B"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: thor TD; A-->B]`
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -138,7 +138,7 @@ describe('packet diagrams', () => {
|
||||
18-20: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 18 - 20 is not contiguous. It should start from 17."'
|
||||
`[Error: Packet block 18 - 20 is not contiguous. It should start from 17.]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -148,7 +148,7 @@ describe('packet diagrams', () => {
|
||||
18: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 18 - 18 is not contiguous. It should start from 17."'
|
||||
`[Error: Packet block 18 - 18 is not contiguous. It should start from 17.]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('packet diagrams', () => {
|
||||
19: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 19 - 19 is not contiguous. It should start from 18."'
|
||||
`[Error: Packet block 19 - 19 is not contiguous. It should start from 18.]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('packet diagrams', () => {
|
||||
25-20: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 25 - 20 is invalid. End must be greater than start."'
|
||||
`[Error: Packet block 25 - 20 is invalid. End must be greater than start.]`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -160,7 +160,7 @@ describe('when using mermaid and ', () => {
|
||||
await expect(
|
||||
mermaid.parse('this is not a mermaid diagram definition')
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: this is not a mermaid diagram definition"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: this is not a mermaid diagram definition]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -172,9 +172,9 @@ describe('when using mermaid and ', () => {
|
||||
it('should throw for an invalid flow definition', async () => {
|
||||
await expect(mermaid.parse('graph TQ;A--x|text including URL space|B;')).rejects
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Lexical error on line 1. Unrecognized text.
|
||||
[Error: Lexical error on line 1. Unrecognized text.
|
||||
graph TQ;A--x|text includ
|
||||
-----^"
|
||||
-----^]
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -204,10 +204,10 @@ describe('when using mermaid and ', () => {
|
||||
'Bob-->Alice: Feel sick...\n' +
|
||||
'end';
|
||||
await expect(mermaid.parse(text)).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Parse error on line 2:
|
||||
[Error: Parse error on line 2:
|
||||
...equenceDiagramAlice:->Bob: Hello Bob, h...
|
||||
----------------------^
|
||||
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', got 'TXT'"
|
||||
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', got 'TXT']
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -219,7 +219,7 @@ describe('when using mermaid and ', () => {
|
||||
await expect(
|
||||
mermaid.parse('this is not a mermaid diagram definition')
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: this is not a mermaid diagram definition"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: this is not a mermaid diagram definition]`
|
||||
);
|
||||
expect(parseErrorWasCalled).toEqual(true);
|
||||
});
|
||||
|
@@ -680,7 +680,7 @@ describe('mermaidAPI', () => {
|
||||
await expect(
|
||||
mermaidAPI.parse('this is not a mermaid diagram definition')
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: this is not a mermaid diagram definition"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: this is not a mermaid diagram definition]`
|
||||
);
|
||||
});
|
||||
it('returns false for invalid definition with silent option', async () => {
|
||||
|
@@ -121,7 +121,7 @@ it('should handle strings with newlines', () => {
|
||||
expect(() =>
|
||||
splitLineToFitWidth(getLineFromString(str), checkFn)
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
'"splitLineToFitWidth does not support newlines in the line"'
|
||||
`[Error: splitLineToFitWidth does not support newlines in the line]`
|
||||
);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user