2021-09-29 06:27:18 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2018-09-06 14:49:13 +00:00
|
|
|
|
|
|
|
describe('sale getClaimableFromTicket()', () => {
|
2019-01-10 06:26:10 +00:00
|
|
|
it('should return the claimable sales of a given ticket', async() => {
|
2021-09-29 06:27:18 +00:00
|
|
|
const tx = await models.Sale.beginTransaction({});
|
2018-09-06 14:49:13 +00:00
|
|
|
|
2021-09-29 06:27:18 +00:00
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
|
|
|
const claimableFromTicket = await models.Sale.getClaimableFromTicket(16, options);
|
|
|
|
|
|
|
|
expect(claimableFromTicket[0].concept).toBe('Ranged weapon longbow 2m');
|
|
|
|
expect(claimableFromTicket.length).toBe(3);
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2018-09-06 14:49:13 +00:00
|
|
|
});
|
|
|
|
});
|