mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-02 10:34:22 +01:00
29 lines
804 B
TypeScript
29 lines
804 B
TypeScript
import { detectType } from './detectType';
|
|
import { getDiagram, registerDiagram } from './diagramAPI';
|
|
|
|
describe('DiagramAPI', () => {
|
|
it('should return default diagrams', () => {
|
|
expect(getDiagram('sequence')).not.toBeNull();
|
|
});
|
|
|
|
it('should throw error if diagram is not defined', () => {
|
|
expect(() => getDiagram('loki')).toThrow();
|
|
});
|
|
|
|
it('should handle diagram registrations', () => {
|
|
expect(() => getDiagram('loki')).toThrow();
|
|
expect(() => detectType('loki diagram')).not.toThrow(); // TODO: #3391
|
|
registerDiagram(
|
|
'loki',
|
|
{
|
|
db: {},
|
|
parser: {},
|
|
renderer: {},
|
|
},
|
|
(text: string) => text.includes('loki')
|
|
);
|
|
expect(getDiagram('loki')).not.toBeNull();
|
|
expect(detectType('loki diagram')).toBe('loki');
|
|
});
|
|
});
|