From fef44b507b67f8695bd21192b319b8500ed2a262 Mon Sep 17 00:00:00 2001 From: nathan-pichon Date: Thu, 19 Jan 2023 16:36:24 +0100 Subject: [PATCH] test(upload): fix find one file test --- .../tests/content-api/upload.test.api.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/core/upload/tests/content-api/upload.test.api.js b/packages/core/upload/tests/content-api/upload.test.api.js index 1d4fde0452..1c2ba590b9 100644 --- a/packages/core/upload/tests/content-api/upload.test.api.js +++ b/packages/core/upload/tests/content-api/upload.test.api.js @@ -165,7 +165,22 @@ describe('Upload plugin', () => { ); }); test('Get one file', async () => { - const getRes = await rq({ method: 'GET', url: '/upload/files/1' }); + const dogEntity = await strapi.entityService.create('api::dog.dog', { + data: {}, + files: { + profilePicture: { + path: path.join(__dirname, '../utils/rec.jpg'), + name: 'rec', + type: 'jpg', + size: 0, + }, + }, + populate: 'profilePicture', + }); + const getRes = await rq({ + method: 'GET', + url: `/upload/files/${dogEntity.profilePicture.id}`, + }); expect(getRes.statusCode).toBe(200); expect(getRes.body).toEqual( @@ -174,6 +189,7 @@ describe('Upload plugin', () => { url: expect.any(String), }) ); + await strapi.entityService.delete('api::dog.dog', dogEntity.id); }); });