remove description properties from item clone
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-05-16 12:51:16 +02:00
parent 599084a8be
commit a0ffde8ed1
2 changed files with 11 additions and 1 deletions

View File

@ -31,7 +31,13 @@ module.exports = Self => {
if (!origin)
throw new UserError(`That item doesn't exists`);
origin.itemTag = undefined;
origin.description = undefined;
origin.image = undefined;
origin.comment = undefined;
const newItem = await Self.create(origin, options);
let promises = [];
await cloneTaxes(origin.id, newItem.id, promises, options);

View File

@ -1,6 +1,6 @@
const app = require('vn-loopback/server/server');
describe('item clone()', () => {
fdescribe('item clone()', () => {
let nextItemId;
beforeEach(async() => {
@ -17,6 +17,10 @@ describe('item clone()', () => {
let result = await app.models.Item.clone(itemFk);
expect(result.id).toEqual(nextItemId);
expect(result.image).toBeUndefined();
expect(result.itemTag).toBeUndefined();
expect(result.comment).toBeUndefined();
expect(result.description).toBeUndefined();
});
it('should attempt to clone the given item but give an error as it doesnt exist', async() => {