17 lines
556 B
JavaScript
17 lines
556 B
JavaScript
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);
|
|
|
|
await models.Collection.setSaleQuantity(saleId, newQuantity);
|
|
const updateSale = await models.Sale.findById(saleId);
|
|
|
|
expect(updateSale.originalQuantity).toEqual(originalSale.quantity);
|
|
expect(updateSale.quantity).toEqual(newQuantity);
|
|
});
|
|
});
|