fixed unit test

This commit is contained in:
khalil
2025-04-06 21:02:22 +01:00
parent d2239549e6
commit 3f493acc6a

View File

@@ -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);