mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(core): Fix payload property in workflow-post-execute
event (#10413)
This commit is contained in:
parent
39c8e50ad0
commit
d98e29e3d5
|
@ -142,7 +142,12 @@ describe('LogStreamingEventRelay', () => {
|
||||||
executionId: 'some-id',
|
executionId: 'some-id',
|
||||||
userId: 'some-id',
|
userId: 'some-id',
|
||||||
workflow: mock<IWorkflowBase>({ id: 'some-id', name: 'some-name' }),
|
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);
|
eventService.emit('workflow-post-execute', payload);
|
||||||
|
@ -153,7 +158,7 @@ describe('LogStreamingEventRelay', () => {
|
||||||
eventName: 'n8n.workflow.success',
|
eventName: 'n8n.workflow.success',
|
||||||
payload: {
|
payload: {
|
||||||
...rest,
|
...rest,
|
||||||
success: true,
|
success: true, // same as finished
|
||||||
isManual: true,
|
isManual: true,
|
||||||
workflowName: 'some-name',
|
workflowName: 'some-name',
|
||||||
workflowId: 'some-id',
|
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>({
|
const runData = mock<IRun>({
|
||||||
status: 'error',
|
status: 'error',
|
||||||
mode: 'manual',
|
mode: 'manual',
|
||||||
|
finished: false,
|
||||||
data: {
|
data: {
|
||||||
resultData: {
|
resultData: {
|
||||||
lastNodeExecuted: 'some-node',
|
lastNodeExecuted: 'some-node',
|
||||||
|
@ -193,7 +199,7 @@ describe('LogStreamingEventRelay', () => {
|
||||||
eventName: 'n8n.workflow.failed',
|
eventName: 'n8n.workflow.failed',
|
||||||
payload: {
|
payload: {
|
||||||
...rest,
|
...rest,
|
||||||
success: false,
|
success: false, // same as finished
|
||||||
isManual: true,
|
isManual: true,
|
||||||
workflowName: 'some-name',
|
workflowName: 'some-name',
|
||||||
workflowId: 'some-id',
|
workflowId: 'some-id',
|
||||||
|
|
|
@ -112,7 +112,7 @@ export class LogStreamingEventRelay extends EventRelay {
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
...rest,
|
...rest,
|
||||||
success: runData?.status === 'success',
|
success: !!runData?.finished, // despite the `success` name, this reports `finished` state
|
||||||
isManual: runData?.mode === 'manual',
|
isManual: runData?.mode === 'manual',
|
||||||
workflowId: workflow.id,
|
workflowId: workflow.id,
|
||||||
workflowName: workflow.name,
|
workflowName: workflow.name,
|
||||||
|
|
Loading…
Reference in a new issue