@yh-ui/flow 1.0.26 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/dist/__tests__/ai-workflow.ssr.test.cjs +0 -352
- package/dist/__tests__/ai-workflow.ssr.test.d.ts +0 -1
- package/dist/__tests__/ai-workflow.ssr.test.mjs +0 -283
- package/dist/__tests__/ai-workflow.test.cjs +0 -109
- package/dist/__tests__/ai-workflow.test.d.ts +0 -1
- package/dist/__tests__/ai-workflow.test.mjs +0 -112
- package/dist/__tests__/bpmn-engine.test.cjs +0 -357
- package/dist/__tests__/bpmn-engine.test.d.ts +0 -1
- package/dist/__tests__/bpmn-engine.test.mjs +0 -406
- package/dist/__tests__/bpmn-utils.test.cjs +0 -268
- package/dist/__tests__/bpmn-utils.test.d.ts +0 -1
- package/dist/__tests__/bpmn-utils.test.mjs +0 -227
- package/dist/__tests__/bpmn-xml.test.cjs +0 -150
- package/dist/__tests__/bpmn-xml.test.d.ts +0 -1
- package/dist/__tests__/bpmn-xml.test.mjs +0 -112
- package/dist/__tests__/bpmn.ssr.test.cjs +0 -278
- package/dist/__tests__/bpmn.ssr.test.d.ts +0 -1
- package/dist/__tests__/bpmn.ssr.test.mjs +0 -237
- package/dist/__tests__/bpmn.test.cjs +0 -103
- package/dist/__tests__/bpmn.test.d.ts +0 -1
- package/dist/__tests__/bpmn.test.mjs +0 -106
- package/dist/__tests__/collaboration.test.cjs +0 -487
- package/dist/__tests__/collaboration.test.d.ts +0 -1
- package/dist/__tests__/collaboration.test.mjs +0 -424
- package/dist/__tests__/custom-types.test.cjs +0 -300
- package/dist/__tests__/custom-types.test.d.ts +0 -1
- package/dist/__tests__/custom-types.test.mjs +0 -248
- package/dist/__tests__/edge-types.test.cjs +0 -275
- package/dist/__tests__/edge-types.test.d.ts +0 -1
- package/dist/__tests__/edge-types.test.mjs +0 -234
- package/dist/__tests__/edge-utils.test.cjs +0 -375
- package/dist/__tests__/edge-utils.test.d.ts +0 -1
- package/dist/__tests__/edge-utils.test.mjs +0 -376
- package/dist/__tests__/edge.test.cjs +0 -56
- package/dist/__tests__/edge.test.d.ts +0 -1
- package/dist/__tests__/edge.test.mjs +0 -69
- package/dist/__tests__/event-bus.test.cjs +0 -80
- package/dist/__tests__/event-bus.test.d.ts +0 -1
- package/dist/__tests__/event-bus.test.mjs +0 -51
- package/dist/__tests__/events-types.test.cjs +0 -184
- package/dist/__tests__/events-types.test.d.ts +0 -1
- package/dist/__tests__/events-types.test.mjs +0 -184
- package/dist/__tests__/export-image-plugin.test.cjs +0 -142
- package/dist/__tests__/export-image-plugin.test.d.ts +0 -1
- package/dist/__tests__/export-image-plugin.test.mjs +0 -118
- package/dist/__tests__/export.test.cjs +0 -237
- package/dist/__tests__/export.test.d.ts +0 -1
- package/dist/__tests__/export.test.mjs +0 -171
- package/dist/__tests__/flow-context.test.cjs +0 -16
- package/dist/__tests__/flow-context.test.d.ts +0 -1
- package/dist/__tests__/flow-context.test.mjs +0 -16
- package/dist/__tests__/flow-props.test.cjs +0 -94
- package/dist/__tests__/flow-props.test.d.ts +0 -1
- package/dist/__tests__/flow-props.test.mjs +0 -92
- package/dist/__tests__/flow.ssr.test.cjs +0 -156
- package/dist/__tests__/flow.ssr.test.d.ts +0 -1
- package/dist/__tests__/flow.ssr.test.mjs +0 -112
- package/dist/__tests__/geometry.test.cjs +0 -191
- package/dist/__tests__/geometry.test.d.ts +0 -1
- package/dist/__tests__/geometry.test.mjs +0 -105
- package/dist/__tests__/graph.test.cjs +0 -115
- package/dist/__tests__/graph.test.d.ts +0 -1
- package/dist/__tests__/graph.test.mjs +0 -85
- package/dist/__tests__/history-plugin.test.cjs +0 -191
- package/dist/__tests__/history-plugin.test.d.ts +0 -1
- package/dist/__tests__/history-plugin.test.mjs +0 -161
- package/dist/__tests__/history.test.cjs +0 -81
- package/dist/__tests__/history.test.d.ts +0 -1
- package/dist/__tests__/history.test.mjs +0 -43
- package/dist/__tests__/layout-plugin.test.cjs +0 -233
- package/dist/__tests__/layout-plugin.test.d.ts +0 -1
- package/dist/__tests__/layout-plugin.test.mjs +0 -215
- package/dist/__tests__/layout.test.cjs +0 -213
- package/dist/__tests__/layout.test.d.ts +0 -1
- package/dist/__tests__/layout.test.mjs +0 -170
- package/dist/__tests__/node-edit-panel.ssr.test.cjs +0 -168
- package/dist/__tests__/node-edit-panel.ssr.test.d.ts +0 -1
- package/dist/__tests__/node-edit-panel.ssr.test.mjs +0 -118
- package/dist/__tests__/node-group-plugin.test.cjs +0 -235
- package/dist/__tests__/node-group-plugin.test.d.ts +0 -1
- package/dist/__tests__/node-group-plugin.test.mjs +0 -187
- package/dist/__tests__/node-handles.test.cjs +0 -340
- package/dist/__tests__/node-handles.test.d.ts +0 -1
- package/dist/__tests__/node-handles.test.mjs +0 -230
- package/dist/__tests__/node-types.test.cjs +0 -368
- package/dist/__tests__/node-types.test.d.ts +0 -1
- package/dist/__tests__/node-types.test.mjs +0 -292
- package/dist/__tests__/performance.test.cjs +0 -313
- package/dist/__tests__/performance.test.d.ts +0 -1
- package/dist/__tests__/performance.test.mjs +0 -218
- package/dist/__tests__/plugin-advanced.test.cjs +0 -301
- package/dist/__tests__/plugin-advanced.test.d.ts +0 -1
- package/dist/__tests__/plugin-advanced.test.mjs +0 -225
- package/dist/__tests__/plugin.test.cjs +0 -151
- package/dist/__tests__/plugin.test.d.ts +0 -1
- package/dist/__tests__/plugin.test.mjs +0 -116
- package/dist/__tests__/plugins.test.cjs +0 -412
- package/dist/__tests__/plugins.test.d.ts +0 -1
- package/dist/__tests__/plugins.test.mjs +0 -402
- package/dist/__tests__/screenshot-capture.test.cjs +0 -183
- package/dist/__tests__/screenshot-capture.test.d.ts +0 -1
- package/dist/__tests__/screenshot-capture.test.mjs +0 -124
- package/dist/__tests__/screenshot.test.cjs +0 -74
- package/dist/__tests__/screenshot.test.d.ts +0 -1
- package/dist/__tests__/screenshot.test.mjs +0 -69
- package/dist/__tests__/theme.test.cjs +0 -185
- package/dist/__tests__/theme.test.d.ts +0 -1
- package/dist/__tests__/theme.test.mjs +0 -191
- package/dist/__tests__/transform.test.cjs +0 -384
- package/dist/__tests__/transform.test.d.ts +0 -1
- package/dist/__tests__/transform.test.mjs +0 -239
- package/dist/__tests__/useAlignment.test.cjs +0 -128
- package/dist/__tests__/useAlignment.test.d.ts +0 -1
- package/dist/__tests__/useAlignment.test.mjs +0 -72
- package/dist/__tests__/useEdges.test.cjs +0 -117
- package/dist/__tests__/useEdges.test.d.ts +0 -1
- package/dist/__tests__/useEdges.test.mjs +0 -80
- package/dist/__tests__/useKeyboard.test.cjs +0 -88
- package/dist/__tests__/useKeyboard.test.d.ts +0 -1
- package/dist/__tests__/useKeyboard.test.mjs +0 -56
- package/dist/__tests__/useNodeDistribution.test.cjs +0 -643
- package/dist/__tests__/useNodeDistribution.test.d.ts +0 -1
- package/dist/__tests__/useNodeDistribution.test.mjs +0 -297
- package/dist/__tests__/useNodes.test.cjs +0 -150
- package/dist/__tests__/useNodes.test.d.ts +0 -1
- package/dist/__tests__/useNodes.test.mjs +0 -80
- package/dist/__tests__/useSelection.test.cjs +0 -112
- package/dist/__tests__/useSelection.test.d.ts +0 -1
- package/dist/__tests__/useSelection.test.mjs +0 -76
- package/dist/__tests__/useViewport.test.cjs +0 -171
- package/dist/__tests__/useViewport.test.d.ts +0 -1
- package/dist/__tests__/useViewport.test.mjs +0 -82
- package/dist/__tests__/utils/ssr.cjs +0 -124
- package/dist/__tests__/utils/ssr.d.ts +0 -33
- package/dist/__tests__/utils/ssr.mjs +0 -129
- package/dist/__tests__/validation.test.cjs +0 -95
- package/dist/__tests__/validation.test.d.ts +0 -1
- package/dist/__tests__/validation.test.mjs +0 -36
- package/dist/__tests__/viewport-types.test.cjs +0 -324
- package/dist/__tests__/viewport-types.test.d.ts +0 -1
- package/dist/__tests__/viewport-types.test.mjs +0 -207
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _customTypes = require("../utils/custom-types.cjs");
|
|
5
|
-
var _aiWorkflow = require("../components/nodes/ai-workflow/index.cjs");
|
|
6
|
-
(0, _vitest.describe)("flow/components/nodes/ai-workflow", () => {
|
|
7
|
-
(0, _vitest.beforeEach)(() => {
|
|
8
|
-
(0, _customTypes.clearCustomTypes)();
|
|
9
|
-
});
|
|
10
|
-
(0, _vitest.describe)("AI Workflow Node Types", () => {
|
|
11
|
-
(0, _vitest.it)("should have correct AI workflow node type constants", () => {
|
|
12
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.LLM).toBe("ai-llm");
|
|
13
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Prompt).toBe("ai-prompt");
|
|
14
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Agent).toBe("ai-agent");
|
|
15
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Tool).toBe("ai-tool");
|
|
16
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Condition).toBe("ai-condition");
|
|
17
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Start).toBe("ai-start");
|
|
18
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.End).toBe("ai-end");
|
|
19
|
-
(0, _vitest.expect)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Memory).toBe("ai-memory");
|
|
20
|
-
});
|
|
21
|
-
(0, _vitest.it)("should have 8 AI workflow node types", () => {
|
|
22
|
-
const types = Object.values(_aiWorkflow.AI_WORKFLOW_NODE_TYPES);
|
|
23
|
-
(0, _vitest.expect)(types).toHaveLength(8);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
(0, _vitest.describe)("AI Workflow Node Registration", () => {
|
|
27
|
-
(0, _vitest.it)("should register all AI workflow node types", () => {
|
|
28
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
29
|
-
const allNodes = (0, _customTypes.getAllCustomNodes)();
|
|
30
|
-
(0, _vitest.expect)(allNodes).toHaveLength(8);
|
|
31
|
-
});
|
|
32
|
-
(0, _vitest.it)("should register LLM node", () => {
|
|
33
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
34
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.LLM);
|
|
35
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
36
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.LLM);
|
|
37
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
38
|
-
});
|
|
39
|
-
(0, _vitest.it)("should register Prompt node", () => {
|
|
40
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
41
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Prompt);
|
|
42
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
43
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Prompt);
|
|
44
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
45
|
-
});
|
|
46
|
-
(0, _vitest.it)("should register Agent node", () => {
|
|
47
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
48
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Agent);
|
|
49
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
50
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Agent);
|
|
51
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
52
|
-
});
|
|
53
|
-
(0, _vitest.it)("should register Tool node", () => {
|
|
54
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
55
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Tool);
|
|
56
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
57
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Tool);
|
|
58
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
59
|
-
});
|
|
60
|
-
(0, _vitest.it)("should register Condition node", () => {
|
|
61
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
62
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Condition);
|
|
63
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
64
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Condition);
|
|
65
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
66
|
-
});
|
|
67
|
-
(0, _vitest.it)("should register Start node", () => {
|
|
68
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
69
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Start);
|
|
70
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
71
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Start);
|
|
72
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
73
|
-
});
|
|
74
|
-
(0, _vitest.it)("should register End node", () => {
|
|
75
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
76
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.End);
|
|
77
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
78
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.End);
|
|
79
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
80
|
-
});
|
|
81
|
-
(0, _vitest.it)("should register Memory node", () => {
|
|
82
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
83
|
-
const node = (0, _customTypes.getCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Memory);
|
|
84
|
-
(0, _vitest.expect)(node).toBeDefined();
|
|
85
|
-
(0, _vitest.expect)(node?.type).toBe(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Memory);
|
|
86
|
-
(0, _vitest.expect)(node?.component).toBeDefined();
|
|
87
|
-
});
|
|
88
|
-
(0, _vitest.it)("should check if AI workflow nodes are registered", () => {
|
|
89
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.LLM)).toBe(false);
|
|
90
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Prompt)).toBe(false);
|
|
91
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
92
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.LLM)).toBe(true);
|
|
93
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Prompt)).toBe(true);
|
|
94
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Agent)).toBe(true);
|
|
95
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Tool)).toBe(true);
|
|
96
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Condition)).toBe(true);
|
|
97
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Start)).toBe(true);
|
|
98
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.End)).toBe(true);
|
|
99
|
-
(0, _vitest.expect)((0, _customTypes.hasCustomNode)(_aiWorkflow.AI_WORKFLOW_NODE_TYPES.Memory)).toBe(true);
|
|
100
|
-
});
|
|
101
|
-
(0, _vitest.it)("should not duplicate nodes on re-registration", () => {
|
|
102
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
103
|
-
const firstCount = (0, _customTypes.getAllCustomNodes)().length;
|
|
104
|
-
(0, _aiWorkflow.registerAiWorkflowNodes)();
|
|
105
|
-
const secondCount = (0, _customTypes.getAllCustomNodes)().length;
|
|
106
|
-
(0, _vitest.expect)(firstCount).toBe(secondCount);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
clearCustomTypes,
|
|
4
|
-
getCustomNode,
|
|
5
|
-
getAllCustomNodes,
|
|
6
|
-
hasCustomNode
|
|
7
|
-
} from "../utils/custom-types.mjs";
|
|
8
|
-
import { registerAiWorkflowNodes, AI_WORKFLOW_NODE_TYPES } from "../components/nodes/ai-workflow/index.mjs";
|
|
9
|
-
describe("flow/components/nodes/ai-workflow", () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
clearCustomTypes();
|
|
12
|
-
});
|
|
13
|
-
describe("AI Workflow Node Types", () => {
|
|
14
|
-
it("should have correct AI workflow node type constants", () => {
|
|
15
|
-
expect(AI_WORKFLOW_NODE_TYPES.LLM).toBe("ai-llm");
|
|
16
|
-
expect(AI_WORKFLOW_NODE_TYPES.Prompt).toBe("ai-prompt");
|
|
17
|
-
expect(AI_WORKFLOW_NODE_TYPES.Agent).toBe("ai-agent");
|
|
18
|
-
expect(AI_WORKFLOW_NODE_TYPES.Tool).toBe("ai-tool");
|
|
19
|
-
expect(AI_WORKFLOW_NODE_TYPES.Condition).toBe("ai-condition");
|
|
20
|
-
expect(AI_WORKFLOW_NODE_TYPES.Start).toBe("ai-start");
|
|
21
|
-
expect(AI_WORKFLOW_NODE_TYPES.End).toBe("ai-end");
|
|
22
|
-
expect(AI_WORKFLOW_NODE_TYPES.Memory).toBe("ai-memory");
|
|
23
|
-
});
|
|
24
|
-
it("should have 8 AI workflow node types", () => {
|
|
25
|
-
const types = Object.values(AI_WORKFLOW_NODE_TYPES);
|
|
26
|
-
expect(types).toHaveLength(8);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe("AI Workflow Node Registration", () => {
|
|
30
|
-
it("should register all AI workflow node types", () => {
|
|
31
|
-
registerAiWorkflowNodes();
|
|
32
|
-
const allNodes = getAllCustomNodes();
|
|
33
|
-
expect(allNodes).toHaveLength(8);
|
|
34
|
-
});
|
|
35
|
-
it("should register LLM node", () => {
|
|
36
|
-
registerAiWorkflowNodes();
|
|
37
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.LLM);
|
|
38
|
-
expect(node).toBeDefined();
|
|
39
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.LLM);
|
|
40
|
-
expect(node?.component).toBeDefined();
|
|
41
|
-
});
|
|
42
|
-
it("should register Prompt node", () => {
|
|
43
|
-
registerAiWorkflowNodes();
|
|
44
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.Prompt);
|
|
45
|
-
expect(node).toBeDefined();
|
|
46
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.Prompt);
|
|
47
|
-
expect(node?.component).toBeDefined();
|
|
48
|
-
});
|
|
49
|
-
it("should register Agent node", () => {
|
|
50
|
-
registerAiWorkflowNodes();
|
|
51
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.Agent);
|
|
52
|
-
expect(node).toBeDefined();
|
|
53
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.Agent);
|
|
54
|
-
expect(node?.component).toBeDefined();
|
|
55
|
-
});
|
|
56
|
-
it("should register Tool node", () => {
|
|
57
|
-
registerAiWorkflowNodes();
|
|
58
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.Tool);
|
|
59
|
-
expect(node).toBeDefined();
|
|
60
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.Tool);
|
|
61
|
-
expect(node?.component).toBeDefined();
|
|
62
|
-
});
|
|
63
|
-
it("should register Condition node", () => {
|
|
64
|
-
registerAiWorkflowNodes();
|
|
65
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.Condition);
|
|
66
|
-
expect(node).toBeDefined();
|
|
67
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.Condition);
|
|
68
|
-
expect(node?.component).toBeDefined();
|
|
69
|
-
});
|
|
70
|
-
it("should register Start node", () => {
|
|
71
|
-
registerAiWorkflowNodes();
|
|
72
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.Start);
|
|
73
|
-
expect(node).toBeDefined();
|
|
74
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.Start);
|
|
75
|
-
expect(node?.component).toBeDefined();
|
|
76
|
-
});
|
|
77
|
-
it("should register End node", () => {
|
|
78
|
-
registerAiWorkflowNodes();
|
|
79
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.End);
|
|
80
|
-
expect(node).toBeDefined();
|
|
81
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.End);
|
|
82
|
-
expect(node?.component).toBeDefined();
|
|
83
|
-
});
|
|
84
|
-
it("should register Memory node", () => {
|
|
85
|
-
registerAiWorkflowNodes();
|
|
86
|
-
const node = getCustomNode(AI_WORKFLOW_NODE_TYPES.Memory);
|
|
87
|
-
expect(node).toBeDefined();
|
|
88
|
-
expect(node?.type).toBe(AI_WORKFLOW_NODE_TYPES.Memory);
|
|
89
|
-
expect(node?.component).toBeDefined();
|
|
90
|
-
});
|
|
91
|
-
it("should check if AI workflow nodes are registered", () => {
|
|
92
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.LLM)).toBe(false);
|
|
93
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Prompt)).toBe(false);
|
|
94
|
-
registerAiWorkflowNodes();
|
|
95
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.LLM)).toBe(true);
|
|
96
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Prompt)).toBe(true);
|
|
97
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Agent)).toBe(true);
|
|
98
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Tool)).toBe(true);
|
|
99
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Condition)).toBe(true);
|
|
100
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Start)).toBe(true);
|
|
101
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.End)).toBe(true);
|
|
102
|
-
expect(hasCustomNode(AI_WORKFLOW_NODE_TYPES.Memory)).toBe(true);
|
|
103
|
-
});
|
|
104
|
-
it("should not duplicate nodes on re-registration", () => {
|
|
105
|
-
registerAiWorkflowNodes();
|
|
106
|
-
const firstCount = getAllCustomNodes().length;
|
|
107
|
-
registerAiWorkflowNodes();
|
|
108
|
-
const secondCount = getAllCustomNodes().length;
|
|
109
|
-
expect(firstCount).toBe(secondCount);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _bpmnEngine = require("../utils/bpmn-engine.cjs");
|
|
5
|
-
function createMockNode(id, type, position = {
|
|
6
|
-
x: 0,
|
|
7
|
-
y: 0
|
|
8
|
-
}) {
|
|
9
|
-
return {
|
|
10
|
-
id,
|
|
11
|
-
type,
|
|
12
|
-
position,
|
|
13
|
-
width: 100,
|
|
14
|
-
height: 80,
|
|
15
|
-
data: {},
|
|
16
|
-
selected: false,
|
|
17
|
-
dragging: false
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function createMockEdge(id, source, target, conditionExpression) {
|
|
21
|
-
return {
|
|
22
|
-
id,
|
|
23
|
-
source,
|
|
24
|
-
target,
|
|
25
|
-
type: "smoothstep",
|
|
26
|
-
data: conditionExpression ? {
|
|
27
|
-
conditionExpression
|
|
28
|
-
} : {},
|
|
29
|
-
selected: false,
|
|
30
|
-
animated: false
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
(0, _vitest.describe)("flow/utils/bpmn-engine", () => {
|
|
34
|
-
let engine;
|
|
35
|
-
let eventListener;
|
|
36
|
-
(0, _vitest.beforeEach)(() => {
|
|
37
|
-
eventListener = _vitest.vi.fn();
|
|
38
|
-
});
|
|
39
|
-
(0, _vitest.describe)("constructor", () => {
|
|
40
|
-
(0, _vitest.it)("should create engine with default options", () => {
|
|
41
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
42
|
-
(0, _vitest.expect)(engine).toBeDefined();
|
|
43
|
-
});
|
|
44
|
-
(0, _vitest.it)("should create engine with custom options", () => {
|
|
45
|
-
const customExecutor = _vitest.vi.fn();
|
|
46
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
47
|
-
taskExecutor: customExecutor,
|
|
48
|
-
autoExecute: false
|
|
49
|
-
});
|
|
50
|
-
(0, _vitest.expect)(engine).toBeDefined();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
(0, _vitest.describe)("createBpmnEngine factory", () => {
|
|
54
|
-
(0, _vitest.it)("should create engine instance", () => {
|
|
55
|
-
const e = (0, _bpmnEngine.createBpmnEngine)();
|
|
56
|
-
(0, _vitest.expect)(e).toBeInstanceOf(_bpmnEngine.BpmnProcessEngine);
|
|
57
|
-
});
|
|
58
|
-
(0, _vitest.it)("should pass options to engine", () => {
|
|
59
|
-
const e = (0, _bpmnEngine.createBpmnEngine)({
|
|
60
|
-
autoExecute: false
|
|
61
|
-
});
|
|
62
|
-
(0, _vitest.expect)(e).toBeInstanceOf(_bpmnEngine.BpmnProcessEngine);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
(0, _vitest.describe)("loadProcess", () => {
|
|
66
|
-
(0, _vitest.it)("should load nodes and edges", () => {
|
|
67
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
68
|
-
const nodes = [createMockNode("n1", "bpmn-start"), createMockNode("n2", "bpmn-task")];
|
|
69
|
-
const edges = [createMockEdge("e1", "n1", "n2")];
|
|
70
|
-
engine.loadProcess(nodes, edges);
|
|
71
|
-
const startNodes = engine.getStartNodes();
|
|
72
|
-
(0, _vitest.expect)(startNodes).toHaveLength(1);
|
|
73
|
-
(0, _vitest.expect)(startNodes[0].id).toBe("n1");
|
|
74
|
-
});
|
|
75
|
-
(0, _vitest.it)("should skip edges without source or target", () => {
|
|
76
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
77
|
-
const nodes = [createMockNode("n1", "bpmn-start")];
|
|
78
|
-
const edges = [{
|
|
79
|
-
id: "e1",
|
|
80
|
-
source: "",
|
|
81
|
-
target: "n2",
|
|
82
|
-
type: "smoothstep"
|
|
83
|
-
}, {
|
|
84
|
-
id: "e2",
|
|
85
|
-
source: "n1",
|
|
86
|
-
target: "",
|
|
87
|
-
type: "smoothstep"
|
|
88
|
-
}, createMockEdge("e3", "n1", "n1")];
|
|
89
|
-
engine.loadProcess(nodes, edges);
|
|
90
|
-
const startNodes = engine.getStartNodes();
|
|
91
|
-
(0, _vitest.expect)(startNodes).toHaveLength(1);
|
|
92
|
-
});
|
|
93
|
-
(0, _vitest.it)("should clear previous data on reload", () => {
|
|
94
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
95
|
-
const nodes1 = [createMockNode("n1", "bpmn-start")];
|
|
96
|
-
engine.loadProcess(nodes1, []);
|
|
97
|
-
(0, _vitest.expect)(engine.getStartNodes()).toHaveLength(1);
|
|
98
|
-
const nodes2 = [];
|
|
99
|
-
engine.loadProcess(nodes2, []);
|
|
100
|
-
(0, _vitest.expect)(engine.getStartNodes()).toHaveLength(0);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
(0, _vitest.describe)("createInstance", () => {
|
|
104
|
-
(0, _vitest.it)("should create process instance with initial variables", () => {
|
|
105
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
106
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
107
|
-
const instance = engine.createInstance({
|
|
108
|
-
var1: "value1"
|
|
109
|
-
});
|
|
110
|
-
(0, _vitest.expect)(instance.variables.var1).toBe("value1");
|
|
111
|
-
(0, _vitest.expect)(instance.state).toBe("idle");
|
|
112
|
-
(0, _vitest.expect)(instance.id).toMatch(/^instance_\d+$/);
|
|
113
|
-
});
|
|
114
|
-
(0, _vitest.it)("should initialize all nodes in instance", () => {
|
|
115
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
116
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start"), createMockNode("n2", "bpmn-task")], []);
|
|
117
|
-
const instance = engine.createInstance();
|
|
118
|
-
(0, _vitest.expect)(instance.nodes.has("n1")).toBe(true);
|
|
119
|
-
(0, _vitest.expect)(instance.nodes.has("n2")).toBe(true);
|
|
120
|
-
});
|
|
121
|
-
(0, _vitest.it)("should initialize all edges in instance", () => {
|
|
122
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
123
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start"), createMockNode("n2", "bpmn-task")], [createMockEdge("e1", "n1", "n2")]);
|
|
124
|
-
const instance = engine.createInstance();
|
|
125
|
-
(0, _vitest.expect)(instance.edges.has("e1")).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
(0, _vitest.describe)("getInstance", () => {
|
|
129
|
-
(0, _vitest.it)("should return instance by id", () => {
|
|
130
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
131
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
132
|
-
const created = engine.createInstance();
|
|
133
|
-
const retrieved = engine.getInstance(created.id);
|
|
134
|
-
(0, _vitest.expect)(retrieved?.id).toBe(created.id);
|
|
135
|
-
});
|
|
136
|
-
(0, _vitest.it)("should return undefined for non-existent id", () => {
|
|
137
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
138
|
-
(0, _vitest.expect)(engine.getInstance("non-existent")).toBeUndefined();
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
(0, _vitest.describe)("getStartNodes / getEndNodes", () => {
|
|
142
|
-
(0, _vitest.it)("should return start nodes", () => {
|
|
143
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
144
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("end", "bpmn-end"), createMockNode("task", "bpmn-task")], []);
|
|
145
|
-
(0, _vitest.expect)(engine.getStartNodes()).toHaveLength(1);
|
|
146
|
-
(0, _vitest.expect)(engine.getStartNodes()[0].type).toBe("bpmn-start");
|
|
147
|
-
});
|
|
148
|
-
(0, _vitest.it)("should return end nodes", () => {
|
|
149
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
150
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("end1", "bpmn-end"), createMockNode("end2", "bpmn-end")], []);
|
|
151
|
-
(0, _vitest.expect)(engine.getEndNodes()).toHaveLength(2);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
(0, _vitest.describe)("getOutgoingEdges / getIncomingEdges", () => {
|
|
155
|
-
(0, _vitest.it)("should return outgoing edges", () => {
|
|
156
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
157
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start"), createMockNode("n2", "bpmn-task"), createMockNode("n3", "bpmn-task")], [createMockEdge("e1", "n1", "n2"), createMockEdge("e2", "n1", "n3")]);
|
|
158
|
-
const outgoing = engine.getOutgoingEdges("n1");
|
|
159
|
-
(0, _vitest.expect)(outgoing).toHaveLength(2);
|
|
160
|
-
});
|
|
161
|
-
(0, _vitest.it)("should return incoming edges", () => {
|
|
162
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
163
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start"), createMockNode("n2", "bpmn-task")], [createMockEdge("e1", "n1", "n2")]);
|
|
164
|
-
const incoming = engine.getIncomingEdges("n2");
|
|
165
|
-
(0, _vitest.expect)(incoming).toHaveLength(1);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
(0, _vitest.describe)("setVariable / getVariable", () => {
|
|
169
|
-
(0, _vitest.it)("should set and get variables", () => {
|
|
170
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
171
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
172
|
-
const instance = engine.createInstance();
|
|
173
|
-
engine.setVariable(instance.id, "key", "value");
|
|
174
|
-
(0, _vitest.expect)(engine.getVariable(instance.id, "key")).toBe("value");
|
|
175
|
-
});
|
|
176
|
-
(0, _vitest.it)("should return undefined for non-existent variable", () => {
|
|
177
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
178
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
179
|
-
const instance = engine.createInstance();
|
|
180
|
-
(0, _vitest.expect)(engine.getVariable(instance.id, "unknown")).toBeUndefined();
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
(0, _vitest.describe)("pause / resume", () => {
|
|
184
|
-
(0, _vitest.it)("should pause running instance", () => {
|
|
185
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
186
|
-
autoExecute: false
|
|
187
|
-
});
|
|
188
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
189
|
-
const instance = engine.createInstance();
|
|
190
|
-
engine.start(instance.id);
|
|
191
|
-
engine.pause(instance.id);
|
|
192
|
-
const retrieved = engine.getInstance(instance.id);
|
|
193
|
-
(0, _vitest.expect)(retrieved?.state).toBe("paused");
|
|
194
|
-
});
|
|
195
|
-
(0, _vitest.it)("should resume paused instance", async () => {
|
|
196
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
197
|
-
autoExecute: false
|
|
198
|
-
});
|
|
199
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
200
|
-
const instance = engine.createInstance();
|
|
201
|
-
engine.start(instance.id);
|
|
202
|
-
engine.pause(instance.id);
|
|
203
|
-
await engine.resume(instance.id);
|
|
204
|
-
});
|
|
205
|
-
(0, _vitest.it)("should do nothing when pausing non-running instance", () => {
|
|
206
|
-
engine = new _bpmnEngine.BpmnProcessEngine();
|
|
207
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
208
|
-
const instance = engine.createInstance();
|
|
209
|
-
engine.pause(instance.id);
|
|
210
|
-
(0, _vitest.expect)(engine.getInstance(instance.id)?.state).toBe("idle");
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
(0, _vitest.describe)("terminate", () => {
|
|
214
|
-
(0, _vitest.it)("should terminate instance", () => {
|
|
215
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
216
|
-
autoExecute: false
|
|
217
|
-
});
|
|
218
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
219
|
-
const instance = engine.createInstance();
|
|
220
|
-
engine.start(instance.id);
|
|
221
|
-
engine.terminate(instance.id);
|
|
222
|
-
const retrieved = engine.getInstance(instance.id);
|
|
223
|
-
(0, _vitest.expect)(retrieved?.state).toBe("terminated");
|
|
224
|
-
(0, _vitest.expect)(retrieved?.endTime).toBeDefined();
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
(0, _vitest.describe)("getAllInstances", () => {
|
|
228
|
-
(0, _vitest.it)("should return all instances", () => {
|
|
229
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
230
|
-
autoExecute: false
|
|
231
|
-
});
|
|
232
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
233
|
-
engine.createInstance();
|
|
234
|
-
engine.createInstance();
|
|
235
|
-
(0, _vitest.expect)(engine.getAllInstances()).toHaveLength(2);
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
(0, _vitest.describe)("event listener", () => {
|
|
239
|
-
(0, _vitest.it)("should call event listener on events", () => {
|
|
240
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
241
|
-
eventListener,
|
|
242
|
-
autoExecute: false
|
|
243
|
-
});
|
|
244
|
-
engine.loadProcess([createMockNode("n1", "bpmn-start")], []);
|
|
245
|
-
engine.createInstance();
|
|
246
|
-
engine.start("instance_1");
|
|
247
|
-
(0, _vitest.expect)(eventListener).toHaveBeenCalled();
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
(0, _vitest.describe)("start with no start nodes", () => {
|
|
251
|
-
(0, _vitest.it)("should complete immediately when no start nodes exist", async () => {
|
|
252
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
253
|
-
autoExecute: false
|
|
254
|
-
});
|
|
255
|
-
engine.loadProcess([createMockNode("n1", "bpmn-task")], []);
|
|
256
|
-
const instance = engine.createInstance();
|
|
257
|
-
await engine.start(instance.id);
|
|
258
|
-
(0, _vitest.expect)(instance.state).toBe("completed");
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
(0, _vitest.describe)("task executor", () => {
|
|
262
|
-
(0, _vitest.it)("should create engine with task executor option", () => {
|
|
263
|
-
const executor = _vitest.vi.fn();
|
|
264
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
265
|
-
taskExecutor: executor,
|
|
266
|
-
autoExecute: false
|
|
267
|
-
});
|
|
268
|
-
(0, _vitest.expect)(engine).toBeDefined();
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
(0, _vitest.describe)("variable evaluator", () => {
|
|
272
|
-
(0, _vitest.it)("should evaluate equality condition", async () => {
|
|
273
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(true);
|
|
274
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
275
|
-
variableEvaluator: evaluator,
|
|
276
|
-
autoExecute: false
|
|
277
|
-
});
|
|
278
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", "${approved == true}")]);
|
|
279
|
-
const instance = engine.createInstance();
|
|
280
|
-
engine.setVariable(instance.id, "approved", true);
|
|
281
|
-
await engine.start(instance.id);
|
|
282
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalled();
|
|
283
|
-
});
|
|
284
|
-
(0, _vitest.it)("should evaluate greater than condition", async () => {
|
|
285
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(false);
|
|
286
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
287
|
-
variableEvaluator: evaluator,
|
|
288
|
-
autoExecute: false
|
|
289
|
-
});
|
|
290
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", "${count > 5}")]);
|
|
291
|
-
const instance = engine.createInstance();
|
|
292
|
-
engine.setVariable(instance.id, "count", 10);
|
|
293
|
-
await engine.start(instance.id);
|
|
294
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalledWith("${count > 5}", {
|
|
295
|
-
count: 10
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
(0, _vitest.it)("should evaluate less than condition", async () => {
|
|
299
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(false);
|
|
300
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
301
|
-
variableEvaluator: evaluator,
|
|
302
|
-
autoExecute: false
|
|
303
|
-
});
|
|
304
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", "${count < 5}")]);
|
|
305
|
-
const instance = engine.createInstance();
|
|
306
|
-
engine.setVariable(instance.id, "count", 3);
|
|
307
|
-
await engine.start(instance.id);
|
|
308
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalled();
|
|
309
|
-
});
|
|
310
|
-
(0, _vitest.it)("should evaluate not equal condition", async () => {
|
|
311
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(false);
|
|
312
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
313
|
-
variableEvaluator: evaluator,
|
|
314
|
-
autoExecute: false
|
|
315
|
-
});
|
|
316
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", '${status != "closed"}')]);
|
|
317
|
-
const instance = engine.createInstance();
|
|
318
|
-
engine.setVariable(instance.id, "status", "open");
|
|
319
|
-
await engine.start(instance.id);
|
|
320
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalled();
|
|
321
|
-
});
|
|
322
|
-
(0, _vitest.it)("should handle simple variable reference", async () => {
|
|
323
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(true);
|
|
324
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
325
|
-
variableEvaluator: evaluator,
|
|
326
|
-
autoExecute: false
|
|
327
|
-
});
|
|
328
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", "${isActive}")]);
|
|
329
|
-
const instance = engine.createInstance();
|
|
330
|
-
engine.setVariable(instance.id, "isActive", true);
|
|
331
|
-
await engine.start(instance.id);
|
|
332
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalled();
|
|
333
|
-
});
|
|
334
|
-
(0, _vitest.it)("should handle true literal", async () => {
|
|
335
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(true);
|
|
336
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
337
|
-
variableEvaluator: evaluator,
|
|
338
|
-
autoExecute: false
|
|
339
|
-
});
|
|
340
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", "${true}")]);
|
|
341
|
-
const instance = engine.createInstance();
|
|
342
|
-
await engine.start(instance.id);
|
|
343
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalled();
|
|
344
|
-
});
|
|
345
|
-
(0, _vitest.it)("should handle false literal", async () => {
|
|
346
|
-
const evaluator = _vitest.vi.fn().mockReturnValue(false);
|
|
347
|
-
engine = new _bpmnEngine.BpmnProcessEngine({
|
|
348
|
-
variableEvaluator: evaluator,
|
|
349
|
-
autoExecute: false
|
|
350
|
-
});
|
|
351
|
-
engine.loadProcess([createMockNode("start", "bpmn-start"), createMockNode("task", "bpmn-task")], [createMockEdge("e1", "start", "task", "${false}")]);
|
|
352
|
-
const instance = engine.createInstance();
|
|
353
|
-
await engine.start(instance.id);
|
|
354
|
-
(0, _vitest.expect)(evaluator).toHaveBeenCalled();
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|