mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(API): Do not add starting node on workflow creation (#6686)
* fix(API): Do not add starting node on workflow creation * chore: Remove comment
This commit is contained in:
@@ -8,6 +8,8 @@ import type { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
|
||||
import { randomApiKey } from '../shared/random';
|
||||
import * as utils from '../shared/utils/';
|
||||
import * as testDb from '../shared/testDb';
|
||||
import type { INode } from 'n8n-workflow';
|
||||
import { STARTING_NODES } from '@/constants';
|
||||
|
||||
let workflowOwnerRole: Role;
|
||||
let owner: User;
|
||||
@@ -676,6 +678,35 @@ describe('POST /workflows', () => {
|
||||
expect(sharedWorkflow?.workflow.createdAt.toISOString()).toBe(createdAt);
|
||||
expect(sharedWorkflow?.role).toEqual(workflowOwnerRole);
|
||||
});
|
||||
|
||||
test('should not add a starting node if the payload has no starting nodes', async () => {
|
||||
const response = await authMemberAgent.post('/workflows').send({
|
||||
name: 'testing',
|
||||
nodes: [
|
||||
{
|
||||
id: 'uuid-1234',
|
||||
parameters: {},
|
||||
name: 'Hacker News',
|
||||
type: 'n8n-nodes-base.hackerNews',
|
||||
typeVersion: 1,
|
||||
position: [240, 300],
|
||||
},
|
||||
],
|
||||
connections: {},
|
||||
settings: {
|
||||
saveExecutionProgress: true,
|
||||
saveManualExecutions: true,
|
||||
saveDataErrorExecution: 'all',
|
||||
saveDataSuccessExecution: 'all',
|
||||
executionTimeout: 3600,
|
||||
timezone: 'America/New_York',
|
||||
},
|
||||
});
|
||||
|
||||
const found = response.body.nodes.find((node: INode) => STARTING_NODES.includes(node.type));
|
||||
|
||||
expect(found).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('PUT /workflows/:id', () => {
|
||||
|
||||
Reference in New Issue
Block a user