mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
feat(Airtop Node): Add Airtop node (#13809)
This commit is contained in:
57
packages/nodes-base/nodes/Airtop/test/node/helpers.ts
Normal file
57
packages/nodes-base/nodes/Airtop/test/node/helpers.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { get } from 'lodash';
|
||||
import { constructExecutionMetaData } from 'n8n-core';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IGetNodeParameterOptions,
|
||||
INode,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const node: INode = {
|
||||
id: '1',
|
||||
name: 'Airtop node',
|
||||
typeVersion: 1,
|
||||
type: 'n8n-nodes-base.airtop',
|
||||
position: [10, 10],
|
||||
parameters: {},
|
||||
};
|
||||
|
||||
export const createMockExecuteFunction = (nodeParameters: IDataObject) => {
|
||||
const fakeExecuteFunction = {
|
||||
getInputData(): INodeExecutionData[] {
|
||||
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,
|
||||
returnJsonArray: (data: IDataObject | IDataObject[]) => {
|
||||
return [{ json: data }] as INodeExecutionData[];
|
||||
},
|
||||
prepareBinaryData: async (data: Buffer) => {
|
||||
return {
|
||||
mimeType: 'image/jpeg',
|
||||
fileType: 'jpg',
|
||||
fileName: 'screenshot.jpg',
|
||||
data: data.toString('base64'),
|
||||
};
|
||||
},
|
||||
},
|
||||
continueOnFail: () => false,
|
||||
logger: {
|
||||
info: () => {},
|
||||
},
|
||||
} as unknown as IExecuteFunctions;
|
||||
return fakeExecuteFunction;
|
||||
};
|
||||
Reference in New Issue
Block a user