2019-01-24 08:08:28 +00:00
|
|
|
const app = require('vn-loopback/server/server');
|
2018-10-02 07:52:38 +00:00
|
|
|
|
|
|
|
describe('Claim importTicketSales()', () => {
|
2021-03-29 13:42:29 +00:00
|
|
|
it('should import sales to a claim actions from an specific ticket', async() => {
|
|
|
|
const ctx = {req: {accessToken: {userId: 5}}};
|
2018-10-02 07:52:38 +00:00
|
|
|
|
2021-03-29 13:42:29 +00:00
|
|
|
const tx = await app.models.Entry.beginTransaction({});
|
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
2019-03-01 10:50:26 +00:00
|
|
|
|
2021-03-29 13:42:29 +00:00
|
|
|
const claimEnds = await app.models.ClaimEnd.importTicketSales(ctx, {
|
|
|
|
claimFk: 1,
|
|
|
|
ticketFk: 1
|
|
|
|
}, options);
|
2018-10-02 07:52:38 +00:00
|
|
|
|
2021-03-29 13:42:29 +00:00
|
|
|
expect(claimEnds.length).toEqual(4);
|
|
|
|
expect(claimEnds[0].saleFk).toEqual(1);
|
|
|
|
expect(claimEnds[2].saleFk).toEqual(3);
|
2018-10-02 07:52:38 +00:00
|
|
|
|
2021-03-29 13:42:29 +00:00
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2018-10-02 07:52:38 +00:00
|
|
|
});
|
|
|
|
});
|