diff --git a/packages/core/test/Helpers.ts b/packages/core/test/Helpers.ts index d7d9e8617f..f0483ec02f 100644 --- a/packages/core/test/Helpers.ts +++ b/packages/core/test/Helpers.ts @@ -8,7 +8,9 @@ import { INodeTypeData, IRun, ITaskData, + IWorkflowBase, IWorkflowExecuteAdditionalData, + WorkflowHooks, } from 'n8n-workflow'; import { @@ -248,20 +250,33 @@ export function NodeTypes(): NodeTypesClass { export function WorkflowExecuteAdditionalData(waitPromise: IDeferredPromise, nodeExecutionOrder: string[]): IWorkflowExecuteAdditionalData { + const hookFunctions = { + nodeExecuteAfter: [ + async (nodeName: string, data: ITaskData): Promise => { + nodeExecutionOrder.push(nodeName); + }, + ], + workflowExecuteAfter: [ + async (fullRunData: IRun): Promise => { + waitPromise.resolve(fullRunData); + }, + ], + }; + + const workflowData: IWorkflowBase = { + name: '', + createdAt: new Date(), + updatedAt: new Date(), + active: true, + nodes: [], + connections: {}, + }; + return { credentials: {}, - hooks: { - nodeExecuteAfter: [ - async (nodeName: string, data: ITaskData): Promise => { - nodeExecutionOrder.push(nodeName); - }, - ], - workflowExecuteAfter: [ - async (fullRunData: IRun): Promise => { - waitPromise.resolve(fullRunData); - }, - ], - }, + hooks: new WorkflowHooks(hookFunctions, 'trigger', '1', workflowData), + executeWorkflow: async (workflowId: string): Promise => {}, // tslint:disable-line:no-any + restApiUrl: '', encryptionKey: 'test', timezone: 'America/New_York', webhookBaseUrl: 'webhook',