2023-01-30 03:20:33 -08:00
|
|
|
import * as Helpers from '../Helpers';
|
2023-05-02 01:37:19 -07:00
|
|
|
import type { WorkflowTestData } from '../types';
|
2023-01-30 03:20:33 -08:00
|
|
|
import { executeWorkflow } from '../ExecuteWorkflow';
|
|
|
|
|
|
|
|
describe('Execute Start Node', () => {
|
2023-05-02 01:37:19 -07:00
|
|
|
const tests: WorkflowTestData[] = [
|
2023-01-30 03:20:33 -08:00
|
|
|
{
|
|
|
|
description: 'should run start node',
|
|
|
|
input: {
|
|
|
|
workflowData: {
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
id: 'uuid-1',
|
|
|
|
parameters: {},
|
|
|
|
name: 'Start',
|
|
|
|
type: 'n8n-nodes-base.start',
|
|
|
|
typeVersion: 1,
|
|
|
|
position: [100, 300],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
connections: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
nodeExecutionOrder: ['Start'],
|
|
|
|
nodeData: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2023-02-06 07:14:57 -08:00
|
|
|
const nodeTypes = Helpers.setup(tests);
|
2023-01-30 03:20:33 -08:00
|
|
|
|
|
|
|
for (const testData of tests) {
|
|
|
|
test(testData.description, async () => {
|
|
|
|
// execute workflow
|
|
|
|
const { result, nodeExecutionOrder } = await executeWorkflow(testData, nodeTypes);
|
|
|
|
// Check if the nodes did execute in the correct order
|
|
|
|
expect(nodeExecutionOrder).toEqual(testData.output.nodeExecutionOrder);
|
|
|
|
// Check if other data has correct value
|
|
|
|
expect(result.finished).toEqual(true);
|
|
|
|
expect(result.data.executionData!.contextData).toEqual({});
|
|
|
|
expect(result.data.executionData!.nodeExecutionStack).toEqual([]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|