mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import get from 'lodash/get';
|
|
import { constructExecutionMetaData } from 'n8n-core';
|
|
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';
|
|
|
|
export const node: INode = {
|
|
id: '11',
|
|
name: 'Airtable node',
|
|
typeVersion: 2,
|
|
type: 'n8n-nodes-base.airtable',
|
|
position: [42, 42],
|
|
parameters: {
|
|
operation: 'create',
|
|
},
|
|
};
|
|
|
|
export const createMockExecuteFunction = (nodeParameters: IDataObject) => {
|
|
const fakeExecuteFunction = {
|
|
getInputData: jest.fn(() => {
|
|
return [{ json: {} }];
|
|
}),
|
|
getNodeParameter: jest.fn(
|
|
(
|
|
parameterName: string,
|
|
_itemIndex: number,
|
|
fallbackValue?: IDataObject,
|
|
options?: IGetNodeParameterOptions,
|
|
) => {
|
|
const parameter = options?.extractValue ? `${parameterName}.value` : parameterName;
|
|
return get(nodeParameters, parameter, fallbackValue);
|
|
},
|
|
),
|
|
getNode: jest.fn(() => {
|
|
return node;
|
|
}),
|
|
helpers: { constructExecutionMetaData: jest.fn(constructExecutionMetaData) },
|
|
continueOnFail: jest.fn(() => false),
|
|
} as unknown as IExecuteFunctions;
|
|
return fakeExecuteFunction;
|
|
};
|