fix: Evaluation nodes - add missing test function and credentialTest to methods (#16734)

This commit is contained in:
Michael Kret
2025-07-03 14:13:45 +03:00
committed by GitHub
parent 71771a76c4
commit 044022f004
5 changed files with 15 additions and 4 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -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';

View File

@@ -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) => {

View File

@@ -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) => {