Bug #730 test
This commit is contained in:
parent
7ed52d455d
commit
f32f63f3c5
|
@ -0,0 +1,25 @@
|
|||
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);
|
||||
app.models.OrderRow.removes({rows: [modifiedRows[modifiedRows.length - 1].id]});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue