mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
a29b41ec55
Co-authored-by: Danny Martini <danny@n8n.io> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { type Workflow } from 'n8n-workflow';
|
|
import { getExecutionStartNode } from '@/WorkflowHelpers';
|
|
import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
|
|
|
|
describe('WorkflowHelpers', () => {
|
|
describe('getExecutionStartNode', () => {
|
|
it('Should return undefined', () => {
|
|
const data = {
|
|
pinData: {},
|
|
startNodes: [],
|
|
} as unknown as IWorkflowExecutionDataProcess;
|
|
const workflow = {
|
|
getNode(nodeName: string) {
|
|
return {
|
|
name: nodeName,
|
|
};
|
|
},
|
|
} as unknown as Workflow;
|
|
const executionStartNode = getExecutionStartNode(data, workflow);
|
|
expect(executionStartNode).toBeUndefined();
|
|
});
|
|
it('Should return startNode', () => {
|
|
const data = {
|
|
pinData: {
|
|
node1: {},
|
|
node2: {},
|
|
},
|
|
startNodes: [{ name: 'node2' }],
|
|
} as unknown as IWorkflowExecutionDataProcess;
|
|
const workflow = {
|
|
getNode(nodeName: string) {
|
|
if (nodeName === 'node2') {
|
|
return {
|
|
name: 'node2',
|
|
};
|
|
}
|
|
return undefined;
|
|
},
|
|
} as unknown as Workflow;
|
|
const executionStartNode = getExecutionStartNode(data, workflow);
|
|
expect(executionStartNode).toEqual({
|
|
name: 'node2',
|
|
});
|
|
});
|
|
});
|
|
});
|