2021-10-07 07:57:07 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2018-07-03 13:00:33 +00:00
|
|
|
|
2023-07-27 05:58:55 +00:00
|
|
|
describe('sale-tracking listSaleTracking()', () => {
|
2019-01-10 06:26:10 +00:00
|
|
|
it('should call the listSaleTracking method and return the response', async() => {
|
2021-10-07 07:57:07 +00:00
|
|
|
const tx = await models.SaleTracking.beginTransaction({});
|
2018-08-30 14:15:30 +00:00
|
|
|
|
2021-10-07 07:57:07 +00:00
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
|
|
|
const filter = {where: {ticketFk: 1}};
|
|
|
|
const result = await models.SaleTracking.listSaleTracking(filter, options);
|
|
|
|
|
|
|
|
expect(result.length).toEqual(4);
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2018-07-03 13:00:33 +00:00
|
|
|
});
|
|
|
|
|
2019-01-10 06:26:10 +00:00
|
|
|
it(`should call the listSaleTracking method and return zero if doesn't have lines`, async() => {
|
2021-10-07 07:57:07 +00:00
|
|
|
const tx = await models.SaleTracking.beginTransaction({});
|
|
|
|
|
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
|
|
|
const filter = {where: {ticketFk: 2}};
|
|
|
|
const result = await models.SaleTracking.listSaleTracking(filter, options);
|
|
|
|
|
|
|
|
expect(result.length).toEqual(0);
|
2018-08-30 14:15:30 +00:00
|
|
|
|
2021-10-07 07:57:07 +00:00
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2018-07-03 13:00:33 +00:00
|
|
|
});
|
|
|
|
});
|