mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-05 03:54:35 +01:00
fixed unit test
This commit is contained in:
@@ -404,16 +404,20 @@ describe('state diagram, ', function () {
|
|||||||
let stateDb;
|
let stateDb;
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
stateDb = new StateDB(1);
|
stateDb = new StateDB(1);
|
||||||
parser.yy = stateDb;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle click directive and store links in stateDb', function () {
|
it('should store links from click statements manually passed to extract()', function () {
|
||||||
const str = `stateDiagram
|
const clickStmt = {
|
||||||
[*] --> S1
|
stmt: 'click',
|
||||||
click S1 "https://example.com" "Go to Example"
|
id: 'S1',
|
||||||
`;
|
url: 'https://example.com',
|
||||||
|
tooltip: 'Go to Example',
|
||||||
|
};
|
||||||
|
|
||||||
parser.parse(str);
|
// Add state explicitly
|
||||||
|
stateDb.addState('S1');
|
||||||
|
// Simulate parser output
|
||||||
|
stateDb.extract([clickStmt]);
|
||||||
|
|
||||||
const links = stateDb.getLinks();
|
const links = stateDb.getLinks();
|
||||||
expect(links.has('S1')).toBe(true);
|
expect(links.has('S1')).toBe(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user