2024-05-23 01:42:10 -07:00
|
|
|
import type { Ref } from 'vue';
|
|
|
|
import { ref } from 'vue';
|
|
|
|
import { NodeConnectionType } from 'n8n-workflow';
|
2024-06-18 22:41:27 -07:00
|
|
|
import type { Workflow } from 'n8n-workflow';
|
|
|
|
import { createPinia, setActivePinia } from 'pinia';
|
|
|
|
|
|
|
|
import { useCanvasMapping } from '@/composables/useCanvasMapping';
|
2024-07-11 03:03:46 -07:00
|
|
|
import type { INodeUi } from '@/Interface';
|
2024-07-08 03:25:18 -07:00
|
|
|
import {
|
|
|
|
createTestWorkflowObject,
|
|
|
|
mockNode,
|
|
|
|
mockNodes,
|
|
|
|
mockNodeTypeDescription,
|
|
|
|
} from '@/__tests__/mocks';
|
2024-07-15 03:00:52 -07:00
|
|
|
import { MANUAL_TRIGGER_NODE_TYPE, SET_NODE_TYPE, STICKY_NODE_TYPE } from '@/constants';
|
2024-07-08 03:25:18 -07:00
|
|
|
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
2024-07-11 03:03:46 -07:00
|
|
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
2024-07-11 07:05:51 -07:00
|
|
|
import {
|
|
|
|
createCanvasConnectionHandleString,
|
|
|
|
createCanvasConnectionId,
|
|
|
|
} from '@/utils/canvasUtilsV2';
|
2024-07-15 03:00:52 -07:00
|
|
|
import { CanvasConnectionMode, CanvasNodeRenderType } from '@/types';
|
2024-07-24 05:47:18 -07:00
|
|
|
import { MarkerType } from '@vue-flow/core';
|
2024-05-23 01:42:10 -07:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const pinia = createPinia();
|
|
|
|
setActivePinia(pinia);
|
2024-07-08 03:25:18 -07:00
|
|
|
|
|
|
|
useNodeTypesStore().setNodeTypes([
|
|
|
|
mockNodeTypeDescription({
|
|
|
|
name: MANUAL_TRIGGER_NODE_TYPE,
|
|
|
|
}),
|
|
|
|
mockNodeTypeDescription({
|
|
|
|
name: SET_NODE_TYPE,
|
|
|
|
}),
|
|
|
|
]);
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vi.clearAllMocks();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('useCanvasMapping', () => {
|
|
|
|
it('should initialize with default props', () => {
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes: INodeUi[] = [];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { nodes: mappedNodes, connections: mappedConnections } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-05-23 01:42:10 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
expect(mappedNodes.value).toEqual([]);
|
|
|
|
expect(mappedConnections.value).toEqual([]);
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
describe('nodes', () => {
|
|
|
|
it('should map nodes to canvas nodes', () => {
|
2024-06-26 06:56:58 -07:00
|
|
|
const manualTriggerNode = mockNode({
|
|
|
|
name: 'Manual Trigger',
|
|
|
|
type: MANUAL_TRIGGER_NODE_TYPE,
|
|
|
|
disabled: false,
|
|
|
|
});
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes = [manualTriggerNode];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-05-23 01:42:10 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
expect(mappedNodes.value).toEqual([
|
2024-05-23 01:42:10 -07:00
|
|
|
{
|
2024-06-18 22:41:27 -07:00
|
|
|
id: manualTriggerNode.id,
|
|
|
|
label: manualTriggerNode.name,
|
2024-05-23 01:42:10 -07:00
|
|
|
type: 'canvas-node',
|
2024-06-18 22:41:27 -07:00
|
|
|
position: expect.anything(),
|
2024-05-23 01:42:10 -07:00
|
|
|
data: {
|
2024-06-18 22:41:27 -07:00
|
|
|
id: manualTriggerNode.id,
|
2024-07-15 03:00:52 -07:00
|
|
|
name: manualTriggerNode.name,
|
2024-07-24 05:47:18 -07:00
|
|
|
subtitle: '',
|
2024-06-18 22:41:27 -07:00
|
|
|
type: manualTriggerNode.type,
|
|
|
|
typeVersion: expect.anything(),
|
2024-06-26 06:56:58 -07:00
|
|
|
disabled: false,
|
2024-07-08 03:25:18 -07:00
|
|
|
execution: {
|
|
|
|
status: 'new',
|
2024-07-10 01:36:00 -07:00
|
|
|
running: false,
|
2024-07-08 03:25:18 -07:00
|
|
|
waiting: undefined,
|
|
|
|
},
|
|
|
|
issues: {
|
|
|
|
items: [],
|
|
|
|
visible: false,
|
|
|
|
},
|
|
|
|
pinnedData: {
|
|
|
|
count: 0,
|
|
|
|
visible: false,
|
|
|
|
},
|
|
|
|
runData: {
|
|
|
|
count: 0,
|
|
|
|
visible: false,
|
|
|
|
},
|
|
|
|
inputs: [
|
|
|
|
{
|
|
|
|
index: 0,
|
|
|
|
label: undefined,
|
|
|
|
type: 'main',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
outputs: [
|
|
|
|
{
|
|
|
|
index: 0,
|
|
|
|
label: undefined,
|
|
|
|
type: 'main',
|
|
|
|
},
|
|
|
|
],
|
2024-06-26 06:56:58 -07:00
|
|
|
connections: {
|
2024-07-18 09:01:14 -07:00
|
|
|
[CanvasConnectionMode.Input]: {},
|
|
|
|
[CanvasConnectionMode.Output]: {},
|
2024-06-26 06:56:58 -07:00
|
|
|
},
|
2024-07-10 07:51:18 -07:00
|
|
|
render: {
|
2024-07-18 09:01:14 -07:00
|
|
|
type: CanvasNodeRenderType.Default,
|
2024-07-10 07:51:18 -07:00
|
|
|
options: {
|
|
|
|
configurable: false,
|
|
|
|
configuration: false,
|
|
|
|
trigger: true,
|
|
|
|
},
|
|
|
|
},
|
2024-05-23 01:42:10 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
2024-06-26 06:56:58 -07:00
|
|
|
|
|
|
|
it('should handle node disabled state', () => {
|
|
|
|
const manualTriggerNode = mockNode({
|
|
|
|
name: 'Manual Trigger',
|
|
|
|
type: MANUAL_TRIGGER_NODE_TYPE,
|
|
|
|
disabled: true,
|
|
|
|
});
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes = [manualTriggerNode];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-06-26 06:56:58 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-06-26 06:56:58 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
expect(mappedNodes.value[0]?.data?.disabled).toEqual(true);
|
2024-06-26 06:56:58 -07:00
|
|
|
});
|
|
|
|
|
2024-07-10 01:36:00 -07:00
|
|
|
it('should handle execution state', () => {
|
|
|
|
const manualTriggerNode = mockNode({
|
|
|
|
name: 'Manual Trigger',
|
|
|
|
type: MANUAL_TRIGGER_NODE_TYPE,
|
|
|
|
disabled: true,
|
|
|
|
});
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes = [manualTriggerNode];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-07-10 01:36:00 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
useWorkflowsStore().addExecutingNode(manualTriggerNode.name);
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-07-10 01:36:00 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
expect(mappedNodes.value[0]?.data?.execution.running).toEqual(true);
|
2024-07-10 01:36:00 -07:00
|
|
|
});
|
|
|
|
|
2024-06-26 06:56:58 -07:00
|
|
|
it('should handle input and output connections', () => {
|
|
|
|
const [manualTriggerNode, setNode] = mockNodes.slice(0, 2);
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes = [manualTriggerNode, setNode];
|
|
|
|
const connections = {
|
|
|
|
[manualTriggerNode.name]: {
|
|
|
|
[NodeConnectionType.Main]: [
|
|
|
|
[{ node: setNode.name, type: NodeConnectionType.Main, index: 0 }],
|
|
|
|
],
|
2024-06-26 06:56:58 -07:00
|
|
|
},
|
2024-07-11 03:03:46 -07:00
|
|
|
};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-06-26 06:56:58 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-06-26 06:56:58 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-18 09:01:14 -07:00
|
|
|
expect(mappedNodes.value[0]?.data?.connections[CanvasConnectionMode.Output]).toHaveProperty(
|
2024-07-11 03:03:46 -07:00
|
|
|
NodeConnectionType.Main,
|
|
|
|
);
|
2024-07-18 09:01:14 -07:00
|
|
|
expect(
|
|
|
|
mappedNodes.value[0]?.data?.connections[CanvasConnectionMode.Output][
|
|
|
|
NodeConnectionType.Main
|
|
|
|
][0][0],
|
|
|
|
).toEqual(
|
2024-06-26 06:56:58 -07:00
|
|
|
expect.objectContaining({
|
|
|
|
node: setNode.name,
|
|
|
|
type: NodeConnectionType.Main,
|
|
|
|
index: 0,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
|
2024-07-18 09:01:14 -07:00
|
|
|
expect(mappedNodes.value[1]?.data?.connections[CanvasConnectionMode.Input]).toHaveProperty(
|
|
|
|
NodeConnectionType.Main,
|
|
|
|
);
|
|
|
|
expect(
|
|
|
|
mappedNodes.value[1]?.data?.connections[CanvasConnectionMode.Input][
|
|
|
|
NodeConnectionType.Main
|
|
|
|
][0][0],
|
|
|
|
).toEqual(
|
2024-06-26 06:56:58 -07:00
|
|
|
expect.objectContaining({
|
|
|
|
node: manualTriggerNode.name,
|
|
|
|
type: NodeConnectionType.Main,
|
|
|
|
index: 0,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
2024-07-15 03:00:52 -07:00
|
|
|
|
|
|
|
describe('render', () => {
|
|
|
|
it('should handle render options for default node type', () => {
|
|
|
|
const manualTriggerNode = mockNode({
|
|
|
|
name: 'Manual Trigger',
|
|
|
|
type: MANUAL_TRIGGER_NODE_TYPE,
|
|
|
|
disabled: false,
|
|
|
|
});
|
|
|
|
const nodes = [manualTriggerNode];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
|
|
|
});
|
|
|
|
|
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(mappedNodes.value[0]?.data?.render).toEqual({
|
|
|
|
type: CanvasNodeRenderType.Default,
|
|
|
|
options: {
|
|
|
|
configurable: false,
|
|
|
|
configuration: false,
|
|
|
|
trigger: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle render options for addNodes node type', () => {
|
|
|
|
const addNodesNode = mockNode({
|
|
|
|
name: CanvasNodeRenderType.AddNodes,
|
|
|
|
type: CanvasNodeRenderType.AddNodes,
|
|
|
|
disabled: false,
|
|
|
|
});
|
|
|
|
const nodes = [addNodesNode];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes: [],
|
|
|
|
connections,
|
|
|
|
});
|
|
|
|
|
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(mappedNodes.value[0]?.data?.render).toEqual({
|
|
|
|
type: CanvasNodeRenderType.AddNodes,
|
|
|
|
options: {},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle render options for stickyNote node type', () => {
|
|
|
|
const stickyNoteNode = mockNode({
|
|
|
|
name: 'Sticky',
|
|
|
|
type: STICKY_NODE_TYPE,
|
|
|
|
disabled: false,
|
|
|
|
parameters: {
|
|
|
|
width: 200,
|
|
|
|
height: 200,
|
|
|
|
color: 3,
|
|
|
|
content: '# Hello world',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const nodes = [stickyNoteNode];
|
|
|
|
const connections = {};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
|
|
|
});
|
|
|
|
|
|
|
|
const { nodes: mappedNodes } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(mappedNodes.value[0]?.data?.render).toEqual({
|
|
|
|
type: CanvasNodeRenderType.StickyNote,
|
|
|
|
options: stickyNoteNode.parameters,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('connections', () => {
|
|
|
|
it('should map connections to canvas connections', () => {
|
2024-06-18 22:41:27 -07:00
|
|
|
const [manualTriggerNode, setNode] = mockNodes.slice(0, 2);
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes = [manualTriggerNode, setNode];
|
|
|
|
const connections = {
|
|
|
|
[manualTriggerNode.name]: {
|
|
|
|
[NodeConnectionType.Main]: [
|
|
|
|
[{ node: setNode.name, type: NodeConnectionType.Main, index: 0 }],
|
|
|
|
],
|
2024-06-18 22:41:27 -07:00
|
|
|
},
|
2024-07-11 03:03:46 -07:00
|
|
|
};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { connections: mappedConnections } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-05-23 01:42:10 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-11 07:05:51 -07:00
|
|
|
const source = manualTriggerNode.id;
|
|
|
|
const sourceHandle = createCanvasConnectionHandleString({
|
|
|
|
type: NodeConnectionType.Main,
|
|
|
|
index: 0,
|
|
|
|
mode: CanvasConnectionMode.Output,
|
|
|
|
});
|
|
|
|
const target = setNode.id;
|
|
|
|
const targetHandle = createCanvasConnectionHandleString({
|
|
|
|
type: NodeConnectionType.Main,
|
|
|
|
index: 0,
|
|
|
|
mode: CanvasConnectionMode.Input,
|
|
|
|
});
|
|
|
|
const connectionId = createCanvasConnectionId({
|
|
|
|
source,
|
|
|
|
sourceHandle,
|
|
|
|
target,
|
|
|
|
targetHandle,
|
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
expect(mappedConnections.value).toEqual([
|
2024-05-23 01:42:10 -07:00
|
|
|
{
|
|
|
|
data: {
|
2024-06-18 22:41:27 -07:00
|
|
|
fromNodeName: manualTriggerNode.name,
|
2024-05-23 01:42:10 -07:00
|
|
|
source: {
|
|
|
|
index: 0,
|
|
|
|
type: NodeConnectionType.Main,
|
|
|
|
},
|
2024-07-08 03:25:18 -07:00
|
|
|
status: undefined,
|
2024-05-23 01:42:10 -07:00
|
|
|
target: {
|
|
|
|
index: 0,
|
|
|
|
type: NodeConnectionType.Main,
|
|
|
|
},
|
|
|
|
},
|
2024-07-11 07:05:51 -07:00
|
|
|
id: connectionId,
|
2024-05-23 01:42:10 -07:00
|
|
|
label: '',
|
2024-07-24 05:47:18 -07:00
|
|
|
markerEnd: MarkerType.ArrowClosed,
|
2024-07-11 07:05:51 -07:00
|
|
|
source,
|
|
|
|
sourceHandle,
|
|
|
|
target,
|
|
|
|
targetHandle,
|
2024-05-23 01:42:10 -07:00
|
|
|
type: 'canvas-edge',
|
2024-07-10 01:36:00 -07:00
|
|
|
animated: false,
|
2024-05-23 01:42:10 -07:00
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should map multiple input types to canvas connections', () => {
|
2024-06-18 22:41:27 -07:00
|
|
|
const [manualTriggerNode, setNode] = mockNodes.slice(0, 2);
|
2024-07-11 03:03:46 -07:00
|
|
|
const nodes = [manualTriggerNode, setNode];
|
|
|
|
const connections = {
|
|
|
|
[manualTriggerNode.name]: {
|
|
|
|
[NodeConnectionType.AiTool]: [
|
|
|
|
[{ node: setNode.name, type: NodeConnectionType.AiTool, index: 0 }],
|
|
|
|
],
|
|
|
|
[NodeConnectionType.AiDocument]: [
|
|
|
|
[{ node: setNode.name, type: NodeConnectionType.AiDocument, index: 1 }],
|
|
|
|
],
|
2024-05-23 01:42:10 -07:00
|
|
|
},
|
2024-07-11 03:03:46 -07:00
|
|
|
};
|
|
|
|
const workflowObject = createTestWorkflowObject({
|
|
|
|
nodes,
|
|
|
|
connections,
|
2024-05-23 01:42:10 -07:00
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
const { connections: mappedConnections } = useCanvasMapping({
|
|
|
|
nodes: ref(nodes),
|
|
|
|
connections: ref(connections),
|
2024-05-23 01:42:10 -07:00
|
|
|
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
|
|
|
});
|
|
|
|
|
2024-07-11 07:05:51 -07:00
|
|
|
const sourceA = manualTriggerNode.id;
|
|
|
|
const sourceHandleA = createCanvasConnectionHandleString({
|
|
|
|
type: NodeConnectionType.AiTool,
|
|
|
|
index: 0,
|
|
|
|
mode: CanvasConnectionMode.Output,
|
|
|
|
});
|
|
|
|
const targetA = setNode.id;
|
|
|
|
const targetHandleA = createCanvasConnectionHandleString({
|
|
|
|
type: NodeConnectionType.AiTool,
|
|
|
|
index: 0,
|
|
|
|
mode: CanvasConnectionMode.Input,
|
|
|
|
});
|
|
|
|
const connectionIdA = createCanvasConnectionId({
|
|
|
|
source: sourceA,
|
|
|
|
sourceHandle: sourceHandleA,
|
|
|
|
target: targetA,
|
|
|
|
targetHandle: targetHandleA,
|
|
|
|
});
|
|
|
|
|
|
|
|
const sourceB = manualTriggerNode.id;
|
|
|
|
const sourceHandleB = createCanvasConnectionHandleString({
|
|
|
|
type: NodeConnectionType.AiDocument,
|
|
|
|
index: 0,
|
|
|
|
mode: CanvasConnectionMode.Output,
|
|
|
|
});
|
|
|
|
const targetB = setNode.id;
|
|
|
|
const targetHandleB = createCanvasConnectionHandleString({
|
|
|
|
type: NodeConnectionType.AiDocument,
|
|
|
|
index: 1,
|
|
|
|
mode: CanvasConnectionMode.Input,
|
|
|
|
});
|
|
|
|
const connectionIdB = createCanvasConnectionId({
|
|
|
|
source: sourceB,
|
|
|
|
sourceHandle: sourceHandleB,
|
|
|
|
target: targetB,
|
|
|
|
targetHandle: targetHandleB,
|
|
|
|
});
|
|
|
|
|
2024-07-11 03:03:46 -07:00
|
|
|
expect(mappedConnections.value).toEqual([
|
2024-05-23 01:42:10 -07:00
|
|
|
{
|
|
|
|
data: {
|
2024-06-18 22:41:27 -07:00
|
|
|
fromNodeName: manualTriggerNode.name,
|
2024-05-23 01:42:10 -07:00
|
|
|
source: {
|
|
|
|
index: 0,
|
|
|
|
type: NodeConnectionType.AiTool,
|
|
|
|
},
|
2024-07-08 03:25:18 -07:00
|
|
|
status: undefined,
|
2024-05-23 01:42:10 -07:00
|
|
|
target: {
|
|
|
|
index: 0,
|
|
|
|
type: NodeConnectionType.AiTool,
|
|
|
|
},
|
|
|
|
},
|
2024-07-11 07:05:51 -07:00
|
|
|
id: connectionIdA,
|
2024-05-23 01:42:10 -07:00
|
|
|
label: '',
|
2024-07-24 05:47:18 -07:00
|
|
|
markerEnd: MarkerType.ArrowClosed,
|
2024-07-11 07:05:51 -07:00
|
|
|
source: sourceA,
|
|
|
|
sourceHandle: sourceHandleA,
|
|
|
|
target: targetA,
|
|
|
|
targetHandle: targetHandleA,
|
2024-05-23 01:42:10 -07:00
|
|
|
type: 'canvas-edge',
|
2024-07-10 01:36:00 -07:00
|
|
|
animated: false,
|
2024-05-23 01:42:10 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
data: {
|
2024-06-18 22:41:27 -07:00
|
|
|
fromNodeName: manualTriggerNode.name,
|
2024-05-23 01:42:10 -07:00
|
|
|
source: {
|
|
|
|
index: 0,
|
|
|
|
type: NodeConnectionType.AiDocument,
|
|
|
|
},
|
2024-07-08 03:25:18 -07:00
|
|
|
status: undefined,
|
2024-05-23 01:42:10 -07:00
|
|
|
target: {
|
|
|
|
index: 1,
|
|
|
|
type: NodeConnectionType.AiDocument,
|
|
|
|
},
|
|
|
|
},
|
2024-07-11 07:05:51 -07:00
|
|
|
id: connectionIdB,
|
2024-05-23 01:42:10 -07:00
|
|
|
label: '',
|
2024-07-11 07:05:51 -07:00
|
|
|
source: sourceB,
|
|
|
|
sourceHandle: sourceHandleB,
|
|
|
|
target: targetB,
|
|
|
|
targetHandle: targetHandleB,
|
2024-05-23 01:42:10 -07:00
|
|
|
type: 'canvas-edge',
|
2024-07-24 05:47:18 -07:00
|
|
|
markerEnd: MarkerType.ArrowClosed,
|
2024-07-10 01:36:00 -07:00
|
|
|
animated: false,
|
2024-05-23 01:42:10 -07:00
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|