7983-testToMaster_2438 #2977

Merged
alexm merged 212 commits from 7983-testToMaster_2438 into master 2024-09-17 05:36:47 +00:00
1 changed files with 34 additions and 13 deletions
Showing only changes of commit 8845f78383 - Show all commits

View File

@ -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');
});
});
});