mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
Fix test and variable names that were copied from flowchart
This commit is contained in:
parent
ec7dd9ef01
commit
e9fb2c8a54
@ -1,23 +1,23 @@
|
|||||||
import flowDb from '../c4Db';
|
import c4Db from '../c4Db';
|
||||||
import flow from './c4Diagram.jison';
|
import c4 from './c4Diagram.jison';
|
||||||
import { setConfig } from '../../../config';
|
import { setConfig } from '../../../config';
|
||||||
|
|
||||||
setConfig({
|
setConfig({
|
||||||
securityLevel: 'strict',
|
securityLevel: 'strict',
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('parsing a flow chart', function () {
|
describe('parsing a C4 diagram', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
flow.parser.yy = flowDb;
|
c4.parser.yy = c4Db;
|
||||||
flow.parser.yy.clear();
|
c4.parser.yy.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse a C4 diagram with one Person correctly', function () {
|
it('should parse a C4 diagram with one Person correctly', function () {
|
||||||
flow.parser.parse(`C4Context
|
c4.parser.parse(`C4Context
|
||||||
title System Context diagram for Internet Banking System
|
title System Context diagram for Internet Banking System
|
||||||
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`);
|
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")`);
|
||||||
|
|
||||||
const yy = flow.parser.yy;
|
const yy = c4.parser.yy;
|
||||||
expect(yy.getC4Type()).toBe('C4Context');
|
expect(yy.getC4Type()).toBe('C4Context');
|
||||||
expect(yy.getTitle()).toBe('System Context diagram for Internet Banking System');
|
expect(yy.getTitle()).toBe('System Context diagram for Internet Banking System');
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b
|
|||||||
|
|
||||||
it('should handle a trailing whitespaces after statements', function () {
|
it('should handle a trailing whitespaces after statements', function () {
|
||||||
const whitespace = ' ';
|
const whitespace = ' ';
|
||||||
const rendered = flow.parser.parse(`C4Context${whitespace}
|
const rendered = c4.parser.parse(`C4Context${whitespace}
|
||||||
title System Context diagram for Internet Banking System${whitespace}
|
title System Context diagram for Internet Banking System${whitespace}
|
||||||
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")${whitespace}`);
|
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")${whitespace}`);
|
||||||
|
|
||||||
@ -51,11 +51,11 @@ Person(customerA, "Banking Customer A", "A customer of the bank, with personal b
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle parameter names that are keywords', function () {
|
it('should handle parameter names that are keywords', function () {
|
||||||
flow.parser.parse(`C4Context
|
c4.parser.parse(`C4Context
|
||||||
title title
|
title title
|
||||||
Person(Person, "Person", "Person")`);
|
Person(Person, "Person", "Person")`);
|
||||||
|
|
||||||
const yy = flow.parser.yy;
|
const yy = c4.parser.yy;
|
||||||
expect(yy.getTitle()).toBe('title');
|
expect(yy.getTitle()).toBe('title');
|
||||||
|
|
||||||
const shapes = yy.getC4ShapeArray();
|
const shapes = yy.getC4ShapeArray();
|
||||||
@ -68,10 +68,10 @@ Person(Person, "Person", "Person")`);
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should allow default in the parameters', function () {
|
it('should allow default in the parameters', function () {
|
||||||
flow.parser.parse(`C4Context
|
c4.parser.parse(`C4Context
|
||||||
Person(default, "default", "default")`);
|
Person(default, "default", "default")`);
|
||||||
|
|
||||||
const yy = flow.parser.yy;
|
const yy = c4.parser.yy;
|
||||||
|
|
||||||
const shapes = yy.getC4ShapeArray();
|
const shapes = yy.getC4ShapeArray();
|
||||||
expect(shapes.length).toBe(1);
|
expect(shapes.length).toBe(1);
|
Loading…
x
Reference in New Issue
Block a user