7983-testToMaster_2438 #2977
|
@ -76,21 +76,42 @@ describe('ticket setDeleted()', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('should show error trying to delete a ticket with a refund', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
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;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const ticketId = 8;
|
||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||
const ticketId = 8;
|
||||
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
error = e;
|
||||
}
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error.message).toContain('Tickets with associated refunds');
|
||||
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