mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix: Evaluation nodes - add missing test function and credentialTest to methods (#16734)
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
|||||||
setOutputProperties,
|
setOutputProperties,
|
||||||
} from './Description.node';
|
} from './Description.node';
|
||||||
import { authentication } from '../../Google/Sheet/v2/actions/versionDescription';
|
import { authentication } from '../../Google/Sheet/v2/actions/versionDescription';
|
||||||
import { listSearch, loadOptions } from '../methods';
|
import { listSearch, loadOptions, credentialTest } from '../methods';
|
||||||
import { checkIfEvaluating, setMetrics, setOutputs, setOutput } from '../utils/evaluationUtils';
|
import { checkIfEvaluating, setMetrics, setOutputs, setOutput } from '../utils/evaluationUtils';
|
||||||
|
|
||||||
export class Evaluation implements INodeType {
|
export class Evaluation implements INodeType {
|
||||||
@@ -87,7 +87,7 @@ export class Evaluation implements INodeType {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
methods = { loadOptions, listSearch };
|
methods = { loadOptions, listSearch, credentialTest };
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { document, sheet } from '../../Google/Sheet/GoogleSheetsTrigger.node';
|
|||||||
import { readFilter } from '../../Google/Sheet/v2/actions/sheet/read.operation';
|
import { readFilter } from '../../Google/Sheet/v2/actions/sheet/read.operation';
|
||||||
import { authentication } from '../../Google/Sheet/v2/actions/versionDescription';
|
import { authentication } from '../../Google/Sheet/v2/actions/versionDescription';
|
||||||
import type { ILookupValues } from '../../Google/Sheet/v2/helpers/GoogleSheets.types';
|
import type { ILookupValues } from '../../Google/Sheet/v2/helpers/GoogleSheets.types';
|
||||||
import { listSearch, loadOptions } from '../methods';
|
import { listSearch, loadOptions, credentialTest } from '../methods';
|
||||||
import {
|
import {
|
||||||
getGoogleSheet,
|
getGoogleSheet,
|
||||||
getResults,
|
getResults,
|
||||||
@@ -106,7 +106,7 @@ export class EvaluationTrigger implements INodeType {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
methods = { loadOptions, listSearch };
|
methods = { loadOptions, listSearch, credentialTest };
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const inputData = this.getInputData();
|
const inputData = this.getInputData();
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export * as loadOptions from './loadOptions';
|
export * as loadOptions from './loadOptions';
|
||||||
export * as listSearch from './../../Google/Sheet/v2/methods/listSearch';
|
export * as listSearch from './../../Google/Sheet/v2/methods/listSearch';
|
||||||
|
export * as credentialTest from './../../Google/Sheet/v2/methods/credentialTest';
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ describe('Test Evaluation', () => {
|
|||||||
return { sheetId: 1, title: sheetName };
|
return { sheetId: 1, title: sheetName };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('credential test for googleApi should be in methods', async () => {
|
||||||
|
const evaluationNode = new Evaluation();
|
||||||
|
expect(evaluationNode.methods.credentialTest.googleApiCredentialTest).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
test('should throw error if output values is empty', async () => {
|
test('should throw error if output values is empty', async () => {
|
||||||
mockExecuteFunctions.getNodeParameter.mockImplementation(
|
mockExecuteFunctions.getNodeParameter.mockImplementation(
|
||||||
(key: string, _: number, fallbackValue?: string | number | boolean | object) => {
|
(key: string, _: number, fallbackValue?: string | number | boolean | object) => {
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ describe('Evaluation Trigger Node', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('credential test for googleApi should be in methods', async () => {
|
||||||
|
const evaluationTrigger = new EvaluationTrigger();
|
||||||
|
expect(evaluationTrigger.methods.credentialTest.googleApiCredentialTest).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
test('should return a single row from google sheet', async () => {
|
test('should return a single row from google sheet', async () => {
|
||||||
mockExecuteFunctions.getNodeParameter.mockImplementation(
|
mockExecuteFunctions.getNodeParameter.mockImplementation(
|
||||||
(key: string, _: number, fallbackValue?: string | number | boolean | object) => {
|
(key: string, _: number, fallbackValue?: string | number | boolean | object) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user