salix/services/order/common/methods/order-row/specs/addToOrder.spec.js

26 lines
756 B
JavaScript
Raw Normal View History

2018-10-15 09:29:17 +00:00
const app = require(`../../../../server/server`);
describe('order addToOrder()', () => {
it('should add a row to a given order', async() => {
let unmodifiedRows = await app.models.OrderRow.find({where: {orderFk: 16}});
expect(unmodifiedRows.length).toBe(4);
let params = {
orderFk: 16,
items: [{
itemFk: 1,
quantity: 1,
warehouseFk: 1
}]
};
await app.models.OrderRow.addToOrder(params);
let modifiedRows = await app.models.OrderRow.find({where: {orderFk: 16}});
expect(modifiedRows.length).toBe(5);
2018-10-15 09:33:23 +00:00
await app.models.OrderRow.removes({rows: [modifiedRows[modifiedRows.length - 1].id]});
2018-10-15 09:29:17 +00:00
});
});