mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-06 18:37:27 -08:00
38 lines
1,018 B
TypeScript
38 lines
1,018 B
TypeScript
|
import { get } from 'lodash';
|
||
|
import type { IDataObject, IExecuteFunctions, IGetNodeParameterOptions, INode } from 'n8n-workflow';
|
||
|
|
||
|
export const telegramNode: INode = {
|
||
|
id: 'b3039263-29ad-4476-9894-51dfcc5a706d',
|
||
|
name: 'Telegram node',
|
||
|
typeVersion: 1.2,
|
||
|
type: 'n8n-nodes-base.telegram',
|
||
|
position: [0, 0],
|
||
|
parameters: {
|
||
|
resource: 'callback',
|
||
|
operation: 'answerQuery',
|
||
|
},
|
||
|
};
|
||
|
|
||
|
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 telegramNode;
|
||
|
},
|
||
|
helpers: {},
|
||
|
continueOnFail: () => false,
|
||
|
} as unknown as IExecuteFunctions;
|
||
|
return fakeExecuteFunction;
|
||
|
};
|