40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
const models = require('vn-loopback/server/server').models;
|
|
|
|
describe('sale-tracking listSaleTracking()', () => {
|
|
it('should call the listSaleTracking method and return the response', async() => {
|
|
const tx = await models.SaleTracking.beginTransaction({});
|
|
|
|
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;
|
|
}
|
|
});
|
|
|
|
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);
|
|
|
|
await tx.rollback();
|
|
} catch (e) {
|
|
await tx.rollback();
|
|
throw e;
|
|
}
|
|
});
|
|
});
|