From 5f2ac8148df1edfc3bde80fc15b0fe3f643ae2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20de=20Juvigny?= <8087692+remidej@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:45:29 +0200 Subject: [PATCH] chore: delete api tests for deleted review workflows route (#20926) --- ...review-workflows-content-types.test.api.ts | 4 +- .../review-workflows.test.api.ts | 66 ++----------------- 2 files changed, 6 insertions(+), 64 deletions(-) diff --git a/tests/api/core/review-workflows/review-workflows-content-types.test.api.ts b/tests/api/core/review-workflows/review-workflows-content-types.test.api.ts index d3f2d90a19..e452acb912 100644 --- a/tests/api/core/review-workflows/review-workflows-content-types.test.api.ts +++ b/tests/api/core/review-workflows/review-workflows-content-types.test.api.ts @@ -72,8 +72,8 @@ describeOnCondition(edition === 'EE')('Review workflows - Content Types', () => }; const getWorkflow = async (id) => { - const { body } = await requests.admin.get(`/review-workflows/workflows/${id}?populate=*`); - return body.data; + const { body } = await requests.admin.get(`/review-workflows/workflows?populate=*`); + return body.data.find((workflow) => workflow.id === id); }; const getWorkflows = async (filters) => { diff --git a/tests/api/core/review-workflows/review-workflows.test.api.ts b/tests/api/core/review-workflows/review-workflows.test.api.ts index b8dcbe76a7..5055639631 100644 --- a/tests/api/core/review-workflows/review-workflows.test.api.ts +++ b/tests/api/core/review-workflows/review-workflows.test.api.ts @@ -170,32 +170,6 @@ describeOnCondition(edition === 'EE')('Review workflows', () => { }); }); - describe('Get one workflow', () => { - test("It shouldn't be available for public", async () => { - const res = await requests.public.get(`/review-workflows/workflows/${testWorkflow.id}`); - - if (hasRW) { - expect(res.status).toBe(401); - } else { - expect(res.status).toBe(404); - expect(res.body.data).toBeUndefined(); - } - }); - test('It should be available for every connected users (admin)', async () => { - const res = await requests.admin.get(`/review-workflows/workflows/${testWorkflow.id}`); - - if (hasRW) { - expect(res.status).toBe(200); - expect(res.body.data).toBeInstanceOf(Object); - expect(res.body.data).toEqual(testWorkflow); - expect(typeof res.body.meta.workflowCount).toBe('number'); - } else { - expect(res.status).toBe(404); - expect(res.body.data).toBeUndefined(); - } - }); - }); - describe('Create workflow', () => { test('It should create a workflow without stages', async () => { const res = await requests.admin.post('/review-workflows/workflows', { @@ -309,36 +283,6 @@ describeOnCondition(edition === 'EE')('Review workflows', () => { }); }); - describe('Get workflow stages', () => { - test("It shouldn't be available for public", async () => { - const res = await requests.public.get( - `/review-workflows/workflows/${testWorkflow.id}?populate=stages` - ); - - if (hasRW) { - expect(res.status).toBe(401); - } else { - expect(res.status).toBe(404); - expect(res.body.data).toBeUndefined(); - } - }); - test('It should be available for every connected users (admin)', async () => { - const res = await requests.admin.get( - `/review-workflows/workflows/${testWorkflow.id}?populate=stages` - ); - - if (hasRW) { - expect(res.status).toBe(200); - expect(res.body.data).toBeInstanceOf(Object); - expect(res.body.data.stages).toBeInstanceOf(Array); - expect(res.body.data.stages).toHaveLength(2); - } else { - expect(res.status).toBe(404); - expect(Array.isArray(res.body)).toBeFalsy(); - } - }); - }); - describe('Get stages', () => { test("It shouldn't be available for public", async () => { const res = await requests.public.get( @@ -426,15 +370,13 @@ describeOnCondition(edition === 'EE')('Review workflows', () => { expect(workflowRes.body.data.stages[1].color).toBe('#000000'); }); test("It shouldn't be available for public", async () => { - const workflowRes = await requests.public.get( - `/review-workflows/workflows/${testWorkflow.id}?populate=*` - ); + const workflowsRes = await requests.public.get(`/review-workflows/workflows?populate=*`); if (hasRW) { - expect(workflowRes.status).toBe(401); + expect(workflowsRes.status).toBe(401); } else { - expect(workflowRes.status).toBe(404); - expect(workflowRes.body.data).toBeUndefined(); + expect(workflowsRes.status).toBe(404); + expect(workflowsRes.body.data).toBeUndefined(); } }); test('It should be available for every connected users (admin)', async () => {