refactor(core): Standardize filenames in cli (no-changelog) (#10484)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
46
packages/cli/src/__tests__/workflow-helpers.test.ts
Normal file
46
packages/cli/src/__tests__/workflow-helpers.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { type Workflow } from 'n8n-workflow';
|
||||
import { getExecutionStartNode } from '@/workflow-helpers';
|
||||
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',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user