feat(n8n Evaluation Node): Add pre-defined metrics to the "Set Metrics" operation (#17127)

This commit is contained in:
jeanpaul
2025-07-11 13:58:26 +02:00
committed by GitHub
parent ba7b2d8fd9
commit a34b30acc7
23 changed files with 1975 additions and 146 deletions

View File

@@ -9,59 +9,10 @@ import {
escapeSingleCurlyBrackets,
getConnectedTools,
hasLongSequentialRepeat,
nodeNameToToolName,
unwrapNestedOutput,
} from '../helpers';
import { N8nTool } from '../N8nTool';
describe('nodeNameToToolName', () => {
const getNodeWithName = (name: string): INode => ({
id: 'test-node',
name,
type: 'test',
typeVersion: 1,
position: [0, 0] as [number, number],
parameters: {},
});
it('should replace spaces with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test Node'))).toBe('Test_Node');
});
it('should replace dots with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test.Node'))).toBe('Test_Node');
});
it('should replace question marks with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test?Node'))).toBe('Test_Node');
});
it('should replace exclamation marks with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test!Node'))).toBe('Test_Node');
});
it('should replace equals signs with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test=Node'))).toBe('Test_Node');
});
it('should replace multiple special characters with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test.Node?With!Special=Chars'))).toBe(
'Test_Node_With_Special_Chars',
);
});
it('should handle names that already have underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test_Node'))).toBe('Test_Node');
});
it('should handle names with consecutive special characters', () => {
expect(nodeNameToToolName(getNodeWithName('Test..!!??==Node'))).toBe('Test_Node');
});
it('should replace various special characters with underscores', () => {
expect(nodeNameToToolName(getNodeWithName('Test#+*()[]{}:;,<>/\\\'"%$Node'))).toBe('Test_Node');
});
});
describe('escapeSingleCurlyBrackets', () => {
it('should return undefined when input is undefined', () => {
expect(escapeSingleCurlyBrackets(undefined)).toBeUndefined();