mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix: Remove Request Options from sub nodes (no-changelog) (#9853)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
import type { INode, INodeParameters, INodeProperties, INodeTypeDescription } from '@/Interfaces';
|
||||
import type {
|
||||
INode,
|
||||
INodeParameters,
|
||||
INodeProperties,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from '@/Interfaces';
|
||||
import type { Workflow } from '@/Workflow';
|
||||
|
||||
import { getNodeParameters, getNodeHints, isSingleExecution } from '@/NodeHelpers';
|
||||
import {
|
||||
getNodeParameters,
|
||||
getNodeHints,
|
||||
isSingleExecution,
|
||||
isSubNodeType,
|
||||
applyDeclarativeNodeOptionParameters,
|
||||
} from '@/NodeHelpers';
|
||||
|
||||
describe('NodeHelpers', () => {
|
||||
describe('getNodeParameters', () => {
|
||||
@@ -3528,6 +3539,7 @@ describe('NodeHelpers', () => {
|
||||
expect(hints).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSingleExecution', () => {
|
||||
test('should determine based on node parameters if it would be executed once', () => {
|
||||
expect(isSingleExecution('n8n-nodes-base.code', {})).toEqual(true);
|
||||
@@ -3555,4 +3567,72 @@ describe('NodeHelpers', () => {
|
||||
expect(isSingleExecution('n8n-nodes-base.redis', {})).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSubNodeType', () => {
|
||||
const tests: Array<[boolean, Pick<INodeTypeDescription, 'outputs'> | null]> = [
|
||||
[false, null],
|
||||
[false, { outputs: '={{random_expression}}' }],
|
||||
[false, { outputs: [] }],
|
||||
[false, { outputs: ['main'] }],
|
||||
[true, { outputs: ['ai_agent'] }],
|
||||
[true, { outputs: ['main', 'ai_agent'] }],
|
||||
];
|
||||
test.each(tests)('should return %p for %o', (expected, nodeType) => {
|
||||
expect(isSubNodeType(nodeType)).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('applyDeclarativeNodeOptionParameters', () => {
|
||||
test.each([
|
||||
[
|
||||
'node with execute method',
|
||||
{
|
||||
execute: jest.fn(),
|
||||
description: {
|
||||
properties: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'node with trigger method',
|
||||
{
|
||||
trigger: jest.fn(),
|
||||
description: {
|
||||
properties: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'node with webhook method',
|
||||
{
|
||||
webhook: jest.fn(),
|
||||
description: {
|
||||
properties: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'a polling node-type',
|
||||
{
|
||||
description: {
|
||||
polling: true,
|
||||
properties: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'a node-type with a non-main output',
|
||||
{
|
||||
description: {
|
||||
outputs: ['main', 'ai_agent'],
|
||||
properties: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
])('should not modify properties on node with %s method', (_, nodeTypeName) => {
|
||||
const nodeType = nodeTypeName as unknown as INodeType;
|
||||
applyDeclarativeNodeOptionParameters(nodeType);
|
||||
expect(nodeType.description.properties).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user