Item islaid and test
This commit is contained in:
parent
9c9db3250e
commit
ff5e601a1e
|
@ -51,6 +51,16 @@ module.exports = Self => {
|
|||
|
||||
const item = await models.Item.create(params, myOptions);
|
||||
|
||||
// set the item.isLaid to be the same as itemType.isLaid (itemType comes from item.typeFk)
|
||||
|
||||
const itemType = await models.ItemType.findById(item.typeFk, myOptions);
|
||||
|
||||
// Update the item with the new isLaid value
|
||||
|
||||
item.isLaid = itemType.isLaid;
|
||||
|
||||
await item.save(myOptions);
|
||||
|
||||
const typeTags = await models.ItemTypeTag.find({
|
||||
where: {itemTypeFk: item.typeFk}
|
||||
}, myOptions);
|
||||
|
|
|
@ -15,6 +15,11 @@ describe('item new()', () => {
|
|||
};
|
||||
|
||||
let item = await models.Item.new(itemParams, options);
|
||||
|
||||
let itemType = await models.ItemType.findById(item.typeFk, options);
|
||||
|
||||
item.isLaid = itemType.isLaid;
|
||||
|
||||
const temporalNameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}}, options);
|
||||
|
||||
const temporalName = await models.ItemTag.findOne({
|
||||
|
@ -26,9 +31,14 @@ describe('item new()', () => {
|
|||
|
||||
item = await models.Item.findById(item.id, null, options);
|
||||
|
||||
itemType = await models.ItemType.findById(item.typeFk, options);
|
||||
|
||||
item.isLaid = itemType.isLaid;
|
||||
|
||||
expect(item.intrastatFk).toEqual(5080000);
|
||||
expect(item.originFk).toEqual(1);
|
||||
expect(item.typeFk).toEqual(2);
|
||||
expect(item.isLaid).toEqual(0);
|
||||
expect(item.name).toEqual('planta');
|
||||
expect(temporalName.value).toEqual('planta');
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
},
|
||||
"isUnconventionalSize": {
|
||||
"type": "number"
|
||||
},
|
||||
"isLaid": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
Loading…
Reference in New Issue