From 027a37bdad117d303e34ee9187d07dc8ec8b0b39 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 21 Dec 2020 10:14:15 +0100 Subject: [PATCH] Requested changes --- back/methods/image/specs/upload.spec.js | 25 ------------------------- back/methods/image/upload.js | 2 -- 2 files changed, 27 deletions(-) diff --git a/back/methods/image/specs/upload.spec.js b/back/methods/image/specs/upload.spec.js index 8521f2f20..86b598b49 100644 --- a/back/methods/image/specs/upload.spec.js +++ b/back/methods/image/specs/upload.spec.js @@ -1,11 +1,6 @@ const app = require('vn-loopback/server/server'); describe('image upload()', () => { - afterEach(() => { - // RESTORE NODE ENV - delete process.env.NODE_ENV; - }); - describe('as buyer', () => { const buyerId = 35; const workerId = 106; @@ -46,26 +41,6 @@ describe('image upload()', () => { expect(containerModel.upload).toHaveBeenCalled(); }); - - it('should throw an error to upload a photo on test environment', async() => { - process.env.NODE_ENV = 'test'; - - const ctx = {req: {accessToken: {userId: buyerId}}, - args: { - id: itemId, - collection: 'catalog' - } - }; - - let error; - try { - await app.models.Image.upload(ctx); - } catch (err) { - error = err; - } - - expect(error.message).toEqual(`You can't upload images on the test instance`); - }); }); describe('as marketing', () => { diff --git a/back/methods/image/upload.js b/back/methods/image/upload.js index 59e9738ec..649d13c68 100644 --- a/back/methods/image/upload.js +++ b/back/methods/image/upload.js @@ -50,8 +50,6 @@ module.exports = Self => { if (process.env.NODE_ENV == 'test') throw new UserError(`You can't upload images on the test instance`); - await TempContainer.allowedContentTypes(); - // Upload file to temporary path const tempContainer = await TempContainer.container(args.collection); const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);