mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(core): Route /rest/workflows/new correctly (no-changelog) (#6572)
This commit is contained in:
committed by
कारतोफ्फेलस्क्रिप्ट™
parent
c2b9d5ac50
commit
c906e7391b
@@ -87,6 +87,7 @@ EEWorkflowController.put(
|
|||||||
|
|
||||||
EEWorkflowController.get(
|
EEWorkflowController.get(
|
||||||
'/:id(\\w+)',
|
'/:id(\\w+)',
|
||||||
|
(req, res, next) => (req.params.id === 'new' ? next('router') : next()), // skip ee router and use free one for naming
|
||||||
ResponseHelper.send(async (req: WorkflowRequest.Get) => {
|
ResponseHelper.send(async (req: WorkflowRequest.Get) => {
|
||||||
const { id: workflowId } = req.params;
|
const { id: workflowId } = req.params;
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,23 @@ describe('GET /workflows', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('GET /workflows/new', () => {
|
||||||
|
[true, false].forEach((sharingEnabled) => {
|
||||||
|
test(`should return an auto-incremented name, even when sharing is ${
|
||||||
|
sharingEnabled ? 'enabled' : 'disabled'
|
||||||
|
}`, async () => {
|
||||||
|
sharingSpy.mockReturnValueOnce(sharingEnabled);
|
||||||
|
|
||||||
|
await createWorkflow({ name: 'My workflow' }, owner);
|
||||||
|
await createWorkflow({ name: 'My workflow 7' }, owner);
|
||||||
|
|
||||||
|
const response = await authOwnerAgent.get('/workflows/new');
|
||||||
|
expect(response.statusCode).toBe(200);
|
||||||
|
expect(response.body.data.name).toEqual('My workflow 8');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('GET /workflows/:id', () => {
|
describe('GET /workflows/:id', () => {
|
||||||
test('GET should fail with invalid id due to route rule', async () => {
|
test('GET should fail with invalid id due to route rule', async () => {
|
||||||
const response = await authOwnerAgent.get('/workflows/potatoes');
|
const response = await authOwnerAgent.get('/workflows/potatoes');
|
||||||
|
|||||||
Reference in New Issue
Block a user