mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(MySQL Node): Overhaul
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { readFileSync, readdirSync, mkdtempSync } from 'fs';
|
||||
import { BinaryDataManager, Credentials } from 'n8n-core';
|
||||
import { BinaryDataManager, Credentials, constructExecutionMetaData } from 'n8n-core';
|
||||
import {
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialsHelper,
|
||||
IDataObject,
|
||||
IDeferredPromise,
|
||||
IExecuteFunctions,
|
||||
IExecuteWorkflowInfo,
|
||||
IGetNodeParameterOptions,
|
||||
IHttpRequestHelper,
|
||||
IHttpRequestOptions,
|
||||
ILogger,
|
||||
@@ -29,6 +31,7 @@ import { WorkflowTestData } from './types';
|
||||
import path from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { get } from 'lodash';
|
||||
|
||||
import { FAKE_CREDENTIALS_DATA } from './FakeCredentialsMap';
|
||||
|
||||
@@ -328,3 +331,31 @@ export const getWorkflowFilenames = (dirname: string) => {
|
||||
|
||||
return workflows;
|
||||
};
|
||||
|
||||
export const createMockExecuteFunction = (
|
||||
nodeParameters: IDataObject,
|
||||
nodeMock: INode,
|
||||
continueBool = false,
|
||||
) => {
|
||||
const fakeExecuteFunction = {
|
||||
getNodeParameter(
|
||||
parameterName: string,
|
||||
_itemIndex: number,
|
||||
fallbackValue?: IDataObject | undefined,
|
||||
options?: IGetNodeParameterOptions | undefined,
|
||||
) {
|
||||
const parameter = options?.extractValue ? `${parameterName}.value` : parameterName;
|
||||
return get(nodeParameters, parameter, fallbackValue);
|
||||
},
|
||||
getNode() {
|
||||
return nodeMock;
|
||||
},
|
||||
continueOnFail() {
|
||||
return continueBool;
|
||||
},
|
||||
helpers: {
|
||||
constructExecutionMetaData,
|
||||
},
|
||||
} as unknown as IExecuteFunctions;
|
||||
return fakeExecuteFunction;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user