fix(core): Fix payload property in workflow-post-execute event (#10413)

This commit is contained in:
Iván Ovejero 2024-08-15 10:01:56 +02:00 committed by GitHub
parent 39c8e50ad0
commit d98e29e3d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View file

@ -142,7 +142,12 @@ describe('LogStreamingEventRelay', () => {
executionId: 'some-id',
userId: 'some-id',
workflow: mock<IWorkflowBase>({ id: 'some-id', name: 'some-name' }),
runData: mock<IRun>({ status: 'success', mode: 'manual', data: { resultData: {} } }),
runData: mock<IRun>({
finished: true,
status: 'success',
mode: 'manual',
data: { resultData: {} },
}),
});
eventService.emit('workflow-post-execute', payload);
@ -153,7 +158,7 @@ describe('LogStreamingEventRelay', () => {
eventName: 'n8n.workflow.success',
payload: {
...rest,
success: true,
success: true, // same as finished
isManual: true,
workflowName: 'some-name',
workflowId: 'some-id',
@ -161,10 +166,11 @@ describe('LogStreamingEventRelay', () => {
});
});
it('should log on `workflow-post-execute` event for unsuccessful execution', () => {
it('should log on `workflow-post-execute` event for failed execution', () => {
const runData = mock<IRun>({
status: 'error',
mode: 'manual',
finished: false,
data: {
resultData: {
lastNodeExecuted: 'some-node',
@ -193,7 +199,7 @@ describe('LogStreamingEventRelay', () => {
eventName: 'n8n.workflow.failed',
payload: {
...rest,
success: false,
success: false, // same as finished
isManual: true,
workflowName: 'some-name',
workflowId: 'some-id',

View file

@ -112,7 +112,7 @@ export class LogStreamingEventRelay extends EventRelay {
const payload = {
...rest,
success: runData?.status === 'success',
success: !!runData?.finished, // despite the `success` name, this reports `finished` state
isManual: runData?.mode === 'manual',
workflowId: workflow.id,
workflowName: workflow.name,