refactor(core): Move single node check outside of the nodes loop (#16959)

This commit is contained in:
Ioannis Canellos
2025-07-11 16:32:26 +03:00
committed by GitHub
parent a34b30acc7
commit f928c58042
2 changed files with 25 additions and 3 deletions

View File

@@ -2586,6 +2586,25 @@ describe('Workflow', () => {
expect(workflow.getStartNode()).toBeUndefined();
});
test('returns the single node when only one non-disabled node exists', () => {
const singleNode = {
name: 'SingleNode',
type: 'test.set',
typeVersion: 1,
id: 'uuid-single',
position: [0, 0],
parameters: {},
} as INode;
const workflow = new Workflow({
nodes: [singleNode],
connections: {},
active: false,
nodeTypes,
});
expect(workflow.getStartNode()).toBe(singleNode);
});
});
describe('getNode', () => {