8179-testToMaster #3176
|
@ -113,5 +113,25 @@ describe('ticket setDeleted()', () => {
|
||||||
|
|
||||||
expect(error.message).not.toContain('Tickets with associated refunds');
|
expect(error.message).not.toContain('Tickets with associated refunds');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should delete a refund ticket from ticketRefund table', async() => {
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const ticketId = 24;
|
||||||
|
const refundTicket = await models.TicketRefund.findOne({where: {refundTicketFk: ticketId}}, options);
|
||||||
|
|
||||||
|
expect(refundTicket).toBeTruthy();
|
||||||
|
|
||||||
|
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||||
|
const isRemoved = await models.TicketRefund.findOne({where: {refundTicketFk: ticketId}}, options);
|
||||||
|
|
||||||
|
expect(isRemoved).toBeNull();
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue