Fix test and variable names that were copied from flowchart

This commit is contained in:
Daniel Bartholomae 2022-08-24 17:17:08 +02:00
parent ec7dd9ef01
commit e9fb2c8a54
No known key found for this signature in database
GPG Key ID: 782CE028698BEE8C
1 changed files with 12 additions and 12 deletions

View File

@ -1,23 +1,23 @@
import flowDb from '../c4Db';
import flow from './c4Diagram.jison';
import c4Db from '../c4Db';
import c4 from './c4Diagram.jison';
import { setConfig } from '../../../config';
setConfig({
securityLevel: 'strict',
});
describe('parsing a flow chart', function () {
describe('parsing a C4 diagram', function () {
beforeEach(function () {
flow.parser.yy = flowDb;
flow.parser.yy.clear();
c4.parser.yy = c4Db;
c4.parser.yy.clear();
});
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
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.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 () {
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}
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 () {
flow.parser.parse(`C4Context
c4.parser.parse(`C4Context
title title
Person(Person, "Person", "Person")`);
const yy = flow.parser.yy;
const yy = c4.parser.yy;
expect(yy.getTitle()).toBe('title');
const shapes = yy.getC4ShapeArray();
@ -68,10 +68,10 @@ Person(Person, "Person", "Person")`);
});
it('should allow default in the parameters', function () {
flow.parser.parse(`C4Context
c4.parser.parse(`C4Context
Person(default, "default", "default")`);
const yy = flow.parser.yy;
const yy = c4.parser.yy;
const shapes = yy.getC4ShapeArray();
expect(shapes.length).toBe(1);