Requested changes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-12-21 10:14:15 +01:00
parent 6717853efb
commit 027a37bdad
2 changed files with 0 additions and 27 deletions

View File

@ -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', () => {

View File

@ -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);