This commit is contained in:
parent
4259339afb
commit
8845f78383
|
@ -76,6 +76,7 @@ describe('ticket setDeleted()', () => {
|
|||
}
|
||||
});
|
||||
|
||||
describe('ticket with refund setDeleted()', () => {
|
||||
it('should show error trying to delete a ticket with a refund', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
let error;
|
||||
|
@ -93,4 +94,24 @@ describe('ticket setDeleted()', () => {
|
|||
|
||||
expect(error.message).toContain('Tickets with associated refunds');
|
||||
});
|
||||
|
||||
it('should delete a ticket with a refund if ticket refund is deleted', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const ticketId = 8;
|
||||
const ticketRefundId = 24;
|
||||
await models.Ticket.updateAll({id: ticketRefundId}, {isDeleted: true}, options);
|
||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error.message).not.toContain('Tickets with associated refunds');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue