mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-27 21:49:41 -08:00
e2c3c7aceb
Github issue / Community forum post (link here to close automatically):
39 lines
1,023 B
TypeScript
39 lines
1,023 B
TypeScript
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';
|
|
|
|
import { get } from 'lodash';
|
|
import { constructExecutionMetaData } from 'n8n-core';
|
|
|
|
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() {
|
|
return [{ json: {} }];
|
|
},
|
|
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 node;
|
|
},
|
|
helpers: { constructExecutionMetaData },
|
|
continueOnFail: () => false,
|
|
} as unknown as IExecuteFunctions;
|
|
return fakeExecuteFunction;
|
|
};
|