test(Execution Data Node): Add tests (no-changelog) (#12208)

This commit is contained in:
Jon
2024-12-16 16:36:19 +00:00
committed by GitHub
parent 3af93b945f
commit b43bec99c0
2 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { mock } from 'jest-mock-extended';
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { testWorkflows, getWorkflowFilenames } from '../../../test/nodes/Helpers';
import { ExecutionData } from '../ExecutionData.node';
describe('ExecutionData Node', () => {
it('should return its input data', async () => {
const mockInputData: INodeExecutionData[] = [
{ json: { item: 0, foo: 'bar' } },
{ json: { item: 1, foo: 'quz' } },
];
const executeFns = mock<IExecuteFunctions>({
getInputData: () => mockInputData,
});
const result = await new ExecutionData().execute.call(executeFns);
expect(result).toEqual([mockInputData]);
});
});
const workflows = getWorkflowFilenames(__dirname);
describe('ExecutionData -> Should run the workflow', () => testWorkflows(workflows));