mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
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:
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user