2022-02-08 11:41:55 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
|
|
|
|
|
|
|
describe('setSaleQuantity()', () => {
|
|
|
|
it('should change quantity sale', async() => {
|
|
|
|
const saleId = 30;
|
|
|
|
const newQuantity = 10;
|
|
|
|
|
|
|
|
const originalSale = await models.Sale.findById(saleId);
|
|
|
|
|
2022-05-06 11:09:37 +00:00
|
|
|
await models.Collection.setSaleQuantity(saleId, newQuantity);
|
2022-02-08 11:41:55 +00:00
|
|
|
const updateSale = await models.Sale.findById(saleId);
|
|
|
|
|
2022-05-06 11:09:37 +00:00
|
|
|
expect(updateSale.originalQuantity).toEqual(originalSale.quantity);
|
2022-02-08 11:41:55 +00:00
|
|
|
expect(updateSale.quantity).toEqual(newQuantity);
|
|
|
|
});
|
|
|
|
});
|