From 700e25382bf51a9fa8b3609d3e69d1c9198b6355 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 27 Aug 2022 15:38:10 +0200 Subject: [PATCH] Copy tests from Person to PersonExt --- src/diagrams/c4/parser/c4PersonExt.spec.js | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/diagrams/c4/parser/c4PersonExt.spec.js b/src/diagrams/c4/parser/c4PersonExt.spec.js index 38d8777be..b9c0e1d7a 100644 --- a/src/diagrams/c4/parser/c4PersonExt.spec.js +++ b/src/diagrams/c4/parser/c4PersonExt.spec.js @@ -44,6 +44,50 @@ Person_Ext(customerA, "Banking Customer A", "A customer of the bank, with person }); }); + it('should parse the alias', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, "Banking Customer A")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + alias: 'customerA', + }); + }); + + it('should parse the label', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, "Banking Customer A")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: 'Banking Customer A', + }, + }); + }); + + it('should parse the description', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, "", "A customer of the bank, with personal bank accounts.")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + descr: { + text: 'A customer of the bank, with personal bank accounts.', + }, + }); + }); + + it('should parse a sprite', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, $sprite="users")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + sprite: 'users', + }, + }, + }); + }); + it('should parse a link', function () { c4.parser.parse(`C4Context Person_Ext(customerA, $link="https://github.com/mermaidjs")`); @@ -56,4 +100,17 @@ Person_Ext(customerA, $link="https://github.com/mermaidjs")`); }, }); }); + + it('should parse tags', function () { + c4.parser.parse(`C4Context +Person_Ext(customerA, $tags="tag1,tag2")`); + + expect(c4.parser.yy.getC4ShapeArray()[0]).toMatchObject({ + label: { + text: { + tags: 'tag1,tag2', + }, + }, + }); + }); });