mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
Add test for structure of Person_Ext
This commit is contained in:
parent
3bc5cfa554
commit
92f0c8f8b1
44
src/diagrams/c4/parser/c4PersonExt.spec.js
Normal file
44
src/diagrams/c4/parser/c4PersonExt.spec.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import c4Db from '../c4Db';
|
||||||
|
import c4 from './c4Diagram.jison';
|
||||||
|
import { setConfig } from '../../../config';
|
||||||
|
|
||||||
|
setConfig({
|
||||||
|
securityLevel: 'strict',
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('parsing a C4 diagram', function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
c4.parser.yy = c4Db;
|
||||||
|
c4.parser.yy.clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse a C4 diagram with one Person_Ext correctly', function () {
|
||||||
|
c4.parser.parse(`C4Context
|
||||||
|
title System Context diagram for Internet Banking System
|
||||||
|
Person_Ext(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`);
|
||||||
|
|
||||||
|
const yy = c4.parser.yy;
|
||||||
|
|
||||||
|
const shapes = yy.getC4ShapeArray();
|
||||||
|
expect(shapes.length).toBe(1);
|
||||||
|
const onlyShape = shapes[0];
|
||||||
|
|
||||||
|
expect(onlyShape).toEqual({
|
||||||
|
alias: 'customerA',
|
||||||
|
descr: {
|
||||||
|
text: 'A customer of the bank, with personal bank accounts.',
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
text: 'Banking Customer A',
|
||||||
|
},
|
||||||
|
link: undefined,
|
||||||
|
sprite: undefined,
|
||||||
|
tags: undefined,
|
||||||
|
parentBoundary: 'global',
|
||||||
|
typeC4Shape: {
|
||||||
|
text: 'external_person',
|
||||||
|
},
|
||||||
|
wrap: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user