test: sankey, pie, seq diagram

This commit is contained in:
Yash Singh
2024-04-16 20:47:47 -07:00
parent 087a5748c8
commit 9b411fa8d4
3 changed files with 12 additions and 6 deletions

View File

@@ -140,10 +140,12 @@ describe('pie', () => {
}); });
it('should handle unsafe properties', async () => { it('should handle unsafe properties', async () => {
await expect(parser.parse(`pie title Unsafe props test await expect(
parser.parse(`pie title Unsafe props test
"__proto__" : 386 "__proto__" : 386
"constructor" : 85 "constructor" : 85
"prototype" : 15`)).resolves.toBeUndefined(); "prototype" : 15`)
).resolves.toBeUndefined();
expect([...db.getSections().keys()]).toEqual(['__proto__', 'constructor', 'prototype']); expect([...db.getSections().keys()]).toEqual(['__proto__', 'constructor', 'prototype']);
}); });
}); });

View File

@@ -22,10 +22,12 @@ describe('Sankey diagram', function () {
}); });
it('allows __proto__ as id', function () { it('allows __proto__ as id', function () {
sankey.parser.parse(prepareTextForParsing(`sankey-beta sankey.parser.parse(
prepareTextForParsing(`sankey-beta
__proto__,A,0.597 __proto__,A,0.597
A,__proto__,0.403 A,__proto__,0.403
`)); `)
);
}); });
}); });
}); });

View File

@@ -2035,8 +2035,10 @@ participant Alice`;
}); });
it.each(['__proto__', 'constructor'])('should allow %s as an actor name', function (prop) { it.each(['__proto__', 'constructor'])('should allow %s as an actor name', function (prop) {
mermaidAPI.parse(` expect(
mermaidAPI.parse(`
sequenceDiagram sequenceDiagram
${prop}-->>A: Hello, how are you?`); ${prop}-->>A: Hello, how are you?`)
).resolves.toBeDefined();
}); });
}); });