Copy tests from Person to PersonExt

This commit is contained in:
Daniel Bartholomae 2022-08-27 15:38:10 +02:00
parent db0d6075ca
commit 700e25382b
No known key found for this signature in database
GPG Key ID: 782CE028698BEE8C
1 changed files with 57 additions and 0 deletions

View File

@ -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',
},
},
});
});
});