feat: refs #7919 test
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-10-14 17:11:12 +02:00
parent 32756dabae
commit ccf9dbde8e
1 changed files with 20 additions and 0 deletions

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();
}
});
});
});