feat(review-workflow): update shape of list result

Use data attribute instead of results
This commit is contained in:
nathan-pichon 2023-01-30 12:26:06 +01:00
parent fcf05cfdd0
commit 081d314423
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -9,10 +9,10 @@ module.exports = {
*/
async find(ctx) {
const workflowService = getService('workflows');
const results = await workflowService.find({});
const data = await workflowService.find({});
ctx.body = {
results,
data,
};
},
/**

View File

@ -54,8 +54,8 @@ describe('Review workflows', () => {
if (hasRW) {
expect(res.status).toBe(200);
expect(Array.isArray(res.body.results)).toBeTruthy();
expect(res.body.results).toHaveLength(1);
expect(Array.isArray(res.body.data)).toBeTruthy();
expect(res.body.data).toHaveLength(1);
} else {
expect(res.status).toBe(404);
expect(Array.isArray(res.body)).toBeFalsy();