remove description properties from item clone
This commit is contained in:
parent
5c9d06b5d2
commit
858916e528
|
@ -31,7 +31,13 @@ module.exports = Self => {
|
||||||
if (!origin)
|
if (!origin)
|
||||||
throw new UserError(`That item doesn't exists`);
|
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);
|
const newItem = await Self.create(origin, options);
|
||||||
|
|
||||||
let promises = [];
|
let promises = [];
|
||||||
|
|
||||||
await cloneTaxes(origin.id, newItem.id, promises, options);
|
await cloneTaxes(origin.id, newItem.id, promises, options);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('item clone()', () => {
|
fdescribe('item clone()', () => {
|
||||||
let nextItemId;
|
let nextItemId;
|
||||||
|
|
||||||
beforeEach(async() => {
|
beforeEach(async() => {
|
||||||
|
@ -17,6 +17,10 @@ describe('item clone()', () => {
|
||||||
let result = await app.models.Item.clone(itemFk);
|
let result = await app.models.Item.clone(itemFk);
|
||||||
|
|
||||||
expect(result.id).toEqual(nextItemId);
|
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() => {
|
it('should attempt to clone the given item but give an error as it doesnt exist', async() => {
|
||||||
|
|
Loading…
Reference in New Issue