mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
refactor: Overhaul nodes-testing setup - Part 2 (no-changelog) (#14873)
This commit is contained in:
committed by
GitHub
parent
897338bd24
commit
91069f057e
@@ -13,12 +13,12 @@ import nock from 'nock';
|
||||
import { CredentialsHelper } from './credentials-helper';
|
||||
import { NodeTypes } from './node-types';
|
||||
|
||||
// This is (temporarily) needed to setup LoadNodesAndCredentials
|
||||
import './Helpers';
|
||||
|
||||
export async function executeWorkflow(testData: WorkflowTestData) {
|
||||
const nodeTypes = Container.get(NodeTypes);
|
||||
|
||||
const credentialsHelper = Container.get(CredentialsHelper);
|
||||
credentialsHelper.setCredentials(testData.credentials ?? {});
|
||||
|
||||
if (testData.nock) {
|
||||
const { baseUrl, mocks } = testData.nock;
|
||||
const agent = nock(baseUrl);
|
||||
@@ -47,6 +47,7 @@ export async function executeWorkflow(testData: WorkflowTestData) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const executionMode = testData.trigger?.mode ?? 'manual';
|
||||
const workflowInstance = new Workflow({
|
||||
id: 'test',
|
||||
@@ -64,12 +65,13 @@ export async function executeWorkflow(testData: WorkflowTestData) {
|
||||
nodeExecutionOrder.push(nodeName);
|
||||
});
|
||||
hooks.addHandler('workflowExecuteAfter', (fullRunData) => waitPromise.resolve(fullRunData));
|
||||
|
||||
const additionalData = mock<IWorkflowExecuteAdditionalData>({
|
||||
credentialsHelper: Container.get(CredentialsHelper),
|
||||
hooks,
|
||||
// Get from node.parameters
|
||||
currentNodeParameters: undefined,
|
||||
});
|
||||
additionalData.credentialsHelper = credentialsHelper;
|
||||
|
||||
let executionData: IRun;
|
||||
const runExecutionData: IRunExecutionData = {
|
||||
|
||||
Reference in New Issue
Block a user