2024-10-03 04:59:15 -07:00
|
|
|
import { mock } from 'jest-mock-extended';
|
2024-11-26 03:38:06 -08:00
|
|
|
import type { IExecuteFunctions, INode, INodeExecutionData } from 'n8n-workflow';
|
2024-10-03 04:59:15 -07:00
|
|
|
|
|
|
|
import { ExecuteWorkflowTrigger } from '../ExecuteWorkflowTrigger.node';
|
|
|
|
|
|
|
|
describe('ExecuteWorkflowTrigger', () => {
|
2024-11-26 06:59:48 -08:00
|
|
|
it('should return its input data on V1', async () => {
|
2024-10-03 04:59:15 -07:00
|
|
|
const mockInputData: INodeExecutionData[] = [
|
|
|
|
{ json: { item: 0, foo: 'bar' } },
|
|
|
|
{ json: { item: 1, foo: 'quz' } },
|
|
|
|
];
|
2024-11-26 03:38:06 -08:00
|
|
|
const mockNode = { typeVersion: 1 } as INode;
|
2024-10-03 04:59:15 -07:00
|
|
|
const executeFns = mock<IExecuteFunctions>({
|
|
|
|
getInputData: () => mockInputData,
|
2024-11-26 03:38:06 -08:00
|
|
|
getNode: () => mockNode,
|
2024-10-03 04:59:15 -07:00
|
|
|
});
|
|
|
|
const result = await new ExecuteWorkflowTrigger().execute.call(executeFns);
|
|
|
|
|
|
|
|
expect(result).toEqual([mockInputData]);
|
|
|
|
});
|
|
|
|
});
|