mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-31 14:16:42 +02:00
27 lines
854 B
JavaScript
27 lines
854 B
JavaScript
import { parser } from './classDiagram.jison';
|
|
import { ClassDB } from '../classDb.js';
|
|
|
|
describe('class diagram', function () {
|
|
let classDb;
|
|
beforeEach(function () {
|
|
classDb = new ClassDB();
|
|
parser.yy = classDb;
|
|
parser.yy.clear();
|
|
});
|
|
|
|
describe('prototype properties', function () {
|
|
it.each(['__proto__', 'constructor'])('should work with a %s property', function (prop) {
|
|
expect(() => parser.parse(`classDiagram\nclass ${prop}`)).not.toThrow();
|
|
expect(() => parser.parse(`classDiagram\nnamespace ${prop} {\n\tclass A\n}`)).not.toThrow();
|
|
});
|
|
});
|
|
|
|
describe('backtick escaping', function () {
|
|
it('should handle backtick-quoted namespace names', function () {
|
|
expect(() =>
|
|
parser.parse(`classDiagram\nnamespace \`A::B\` {\n\tclass \`IPC::Sender\`\n}`)
|
|
).not.toThrow();
|
|
});
|
|
});
|
|
});
|