mirror of
https://github.com/strapi/strapi.git
synced 2025-09-05 06:43:07 +00:00
Revert "chore: delete api tests for deleted review workflows route"
This reverts commit 2b4e5ebd4101eb6e15ae45791ae0ff56e0208e6f.
This commit is contained in:
parent
2b4e5ebd41
commit
0f4c208520
@ -72,8 +72,8 @@ describeOnCondition(edition === 'EE')('Review workflows - Content Types', () =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getWorkflow = async (id) => {
|
const getWorkflow = async (id) => {
|
||||||
const { body } = await requests.admin.get(`/review-workflows/workflows?populate=*`);
|
const { body } = await requests.admin.get(`/review-workflows/workflows/${id}?populate=*`);
|
||||||
return body.data.find((workflow) => workflow.id === id);
|
return body.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getWorkflows = async (filters) => {
|
const getWorkflows = async (filters) => {
|
||||||
|
@ -170,6 +170,32 @@ 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', () => {
|
describe('Create workflow', () => {
|
||||||
test('It should create a workflow without stages', async () => {
|
test('It should create a workflow without stages', async () => {
|
||||||
const res = await requests.admin.post('/review-workflows/workflows', {
|
const res = await requests.admin.post('/review-workflows/workflows', {
|
||||||
@ -283,6 +309,36 @@ 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', () => {
|
describe('Get stages', () => {
|
||||||
test("It shouldn't be available for public", async () => {
|
test("It shouldn't be available for public", async () => {
|
||||||
const res = await requests.public.get(
|
const res = await requests.public.get(
|
||||||
@ -370,13 +426,15 @@ describeOnCondition(edition === 'EE')('Review workflows', () => {
|
|||||||
expect(workflowRes.body.data.stages[1].color).toBe('#000000');
|
expect(workflowRes.body.data.stages[1].color).toBe('#000000');
|
||||||
});
|
});
|
||||||
test("It shouldn't be available for public", async () => {
|
test("It shouldn't be available for public", async () => {
|
||||||
const workflowsRes = await requests.public.get(`/review-workflows/workflows?populate=*`);
|
const workflowRes = await requests.public.get(
|
||||||
|
`/review-workflows/workflows/${testWorkflow.id}?populate=*`
|
||||||
|
);
|
||||||
|
|
||||||
if (hasRW) {
|
if (hasRW) {
|
||||||
expect(workflowsRes.status).toBe(401);
|
expect(workflowRes.status).toBe(401);
|
||||||
} else {
|
} else {
|
||||||
expect(workflowsRes.status).toBe(404);
|
expect(workflowRes.status).toBe(404);
|
||||||
expect(workflowsRes.body.data).toBeUndefined();
|
expect(workflowRes.body.data).toBeUndefined();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
test('It should be available for every connected users (admin)', async () => {
|
test('It should be available for every connected users (admin)', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user