mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
add unit test
This commit is contained in:
parent
87056ebd87
commit
e5a87523bd
@ -200,6 +200,23 @@ describe('Folder', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('Can read a folder & populate its parent', async () => {
|
||||
const res = await rq({
|
||||
method: 'GET',
|
||||
url: `/upload/folders/${data.folders[1].id}`,
|
||||
qs: {
|
||||
populate: 'parent',
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.body.data).toMatchObject({
|
||||
...pick(['id', 'name', 'pathId', 'path', 'createAt', 'updatedAt'], data.folders[1]),
|
||||
parent: {
|
||||
id: expect.any(Number),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('Return 404 when folder does not exist', async () => {
|
||||
const res = await rq({
|
||||
method: 'GET',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user