2021-10-22 15:32:10 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2021-05-18 06:41:36 +00:00
|
|
|
|
|
|
|
describe('SalesMonitor deleteOrders()', () => {
|
|
|
|
it('should return the deleted orders', async() => {
|
2021-10-22 15:32:10 +00:00
|
|
|
const tx = await models.Order.beginTransaction({});
|
2021-05-18 06:41:36 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
|
|
|
const deletes = [1, 2];
|
2021-10-22 15:32:10 +00:00
|
|
|
const result = await models.SalesMonitor.deleteOrders(deletes, options);
|
2021-05-18 06:41:36 +00:00
|
|
|
|
|
|
|
expect(result.count).toEqual(2);
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|