mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-05 09:57:27 -08:00
7ad4badd2d
Some checks failed
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Has been cancelled
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;
|
|
};
|