feat: Send node execution finished and node execution data in separate events (no-changelog) (#18875)

Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
This commit is contained in:
Alex Grozav
2025-09-12 13:56:13 +01:00
committed by GitHub
parent 26f27efd75
commit 10fa3a9b01
28 changed files with 325 additions and 159 deletions

View File

@@ -0,0 +1,42 @@
import { createTestingPinia } from '@pinia/testing';
import { setActivePinia } from 'pinia';
import { nodeExecuteAfterData } from './nodeExecuteAfterData';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { mockedStore } from '@/__tests__/utils';
import type { NodeExecuteAfterData } from '@n8n/api-types/push/execution';
describe('nodeExecuteAfterData', () => {
beforeEach(() => {
const pinia = createTestingPinia({
stubActions: true,
});
setActivePinia(pinia);
});
it('should update node execution data with incoming payload', async () => {
const workflowsStore = mockedStore(useWorkflowsStore);
const event: NodeExecuteAfterData = {
type: 'nodeExecuteAfterData',
data: {
executionId: 'exec-1',
nodeName: 'Test Node',
itemCount: 1,
data: {
executionTime: 0,
startTime: 0,
executionIndex: 0,
source: [],
data: {
main: [[{ json: { foo: 'bar' } }]],
},
},
},
};
await nodeExecuteAfterData(event);
expect(workflowsStore.updateNodeExecutionData).toHaveBeenCalledTimes(1);
expect(workflowsStore.updateNodeExecutionData).toHaveBeenCalledWith(event.data);
});
});