mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
test: requirement, sankey
This commit is contained in:
parent
c993a817d1
commit
6105185d05
@ -415,10 +415,6 @@ columns 1
|
||||
).not.toThrow();
|
||||
}
|
||||
|
||||
it('should work with a prototype property', function () {
|
||||
validateProperty('prototype');
|
||||
});
|
||||
|
||||
it('should work with a __proto__ property', function () {
|
||||
validateProperty('__proto__');
|
||||
});
|
||||
|
@ -13,10 +13,6 @@ describe('class diagram', function () {
|
||||
expect(() => parser.parse(`classDiagram\nnamespace ${prop} {\n\tclass A\n}`)).not.toThrow();
|
||||
}
|
||||
|
||||
it('should work with a prototype property', function () {
|
||||
validateProperty('prototype');
|
||||
});
|
||||
|
||||
it('should work with a __proto__ property', function () {
|
||||
validateProperty('__proto__');
|
||||
});
|
||||
|
@ -195,7 +195,7 @@ with a second line`
|
||||
);
|
||||
});
|
||||
|
||||
for (const unsafeProp of ['__proto__', 'constructor', 'prototype']) {
|
||||
for (const unsafeProp of ['__proto__', 'constructor']) {
|
||||
it(`should work with node id ${unsafeProp}`, function () {
|
||||
const flowChart = `graph LR
|
||||
${unsafeProp} --> A;`;
|
||||
|
@ -257,7 +257,7 @@ row2`;
|
||||
}
|
||||
);
|
||||
|
||||
it.each(['__proto__', 'constructor', 'prototype'])('should allow for a link to %s id', (prop) => {
|
||||
it.each(['__proto__', 'constructor'])('should allow for a link to %s id', (prop) => {
|
||||
expect(() =>
|
||||
parser.parse(`gantt
|
||||
dateFormat YYYY-MM-DD
|
||||
|
@ -1097,7 +1097,7 @@ describe('when parsing a gitGraph', function () {
|
||||
});
|
||||
|
||||
describe('unsafe properties', () => {
|
||||
for (const prop of ['__proto__', 'constructor', 'prototype']) {
|
||||
for (const prop of ['__proto__', 'constructor']) {
|
||||
it(`should work with custom commit id or branch name ${prop}`, () => {
|
||||
const str = `gitGraph
|
||||
commit id:"${prop}"
|
||||
|
@ -578,4 +578,25 @@ line 2`;
|
||||
let foundRelationship = requirementDb.getRelationships()[0];
|
||||
expect(foundRelationship.type).toBe(expectedType);
|
||||
});
|
||||
|
||||
for (const property of ['__proto__', 'constructor']) {
|
||||
it(`will accept ${property} as requirement id`, function () {
|
||||
reqDiagram.parser.parse(`requirementDiagram
|
||||
requirement ${property} {
|
||||
id: 1
|
||||
text: the test text.
|
||||
risk: high
|
||||
verifymethod: test
|
||||
}`);
|
||||
expect(reqDiagram.parser.yy.getRequirements().size).toBe(1);
|
||||
});
|
||||
|
||||
it(`will accept ${property} as element id`, function () {
|
||||
reqDiagram.parser.parse(`requirementDiagram
|
||||
element ${property} {
|
||||
type: simulation
|
||||
}`);
|
||||
expect(reqDiagram.parser.yy.getElements().size).toBe(1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -20,5 +20,12 @@ describe('Sankey diagram', function () {
|
||||
|
||||
sankey.parser.parse(graphDefinition);
|
||||
});
|
||||
|
||||
it('allows __proto__ as id', function () {
|
||||
sankey.parser.parse(prepareTextForParsing(`sankey-beta
|
||||
__proto__,A,0.597
|
||||
A,__proto__,0.403
|
||||
`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user