salix/modules/ticket/back/methods/sale-tracking/specs/listSaleTracking.spec.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

const models = require('vn-loopback/server/server').models;
2018-10-25 09:49:38 +00:00
describe('ticket listSaleTracking()', () => {
2019-01-10 06:26:10 +00:00
it('should call the listSaleTracking method and return the response', async() => {
const tx = await models.SaleTracking.beginTransaction({});
2018-08-30 14:15:30 +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;
}
});
2019-01-10 06:26:10 +00:00
it(`should call the listSaleTracking method and return zero if doesn't have lines`, async() => {
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
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});