#7919 delete if ticketRefund #3091

Merged
jorgep merged 9 commits from 7919-deleteTicketRefund into dev 2024-10-21 11:21:34 +00:00
1 changed files with 20 additions and 0 deletions
Showing only changes of commit ccf9dbde8e - Show all commits

View File

@ -113,5 +113,25 @@ describe('ticket setDeleted()', () => {
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();
}
});
});
});