This commit is contained in:
parent
e9dca9211c
commit
b2bf7f2727
|
@ -2773,3 +2773,6 @@ INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 1);
|
(1, NULL, 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 30);
|
||||||
|
|
|
@ -759,8 +759,8 @@ export default {
|
||||||
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
|
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
|
||||||
moveButton: 'vn-button[vn-tooltip="Future tickets"]',
|
moveButton: 'vn-button[vn-tooltip="Future tickets"]',
|
||||||
acceptButton: '.vn-confirm.shown button[response="accept"]',
|
acceptButton: '.vn-confirm.shown button[response="accept"]',
|
||||||
firstCheck: 'tbody > tr:nth-child(1) > td > vn-check',
|
secondCheck: 'tbody > tr:nth-child(2) > td > vn-check',
|
||||||
multiCheck: 'vn-multi-check',
|
thirdCheck: 'tbody > tr:nth-child(3) > td > vn-check',
|
||||||
tableId: 'vn-textfield[name="id"]',
|
tableId: 'vn-textfield[name="id"]',
|
||||||
tableFutureId: 'vn-textfield[name="futureId"]',
|
tableFutureId: 'vn-textfield[name="futureId"]',
|
||||||
tableLiters: 'vn-textfield[name="liters"]',
|
tableLiters: 'vn-textfield[name="liters"]',
|
||||||
|
|
|
@ -152,13 +152,22 @@ describe('Ticket Future path', () => {
|
||||||
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
await page.waitForNumberOfElements(selectors.ticketFuture.table, 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the three last tickets and move to the future', async() => {
|
it('should check the two tickets and move to the future', async() => {
|
||||||
await page.waitToClick(selectors.ticketFuture.multiCheck);
|
await page.waitToClick(selectors.ticketFuture.secondCheck);
|
||||||
await page.waitToClick(selectors.ticketFuture.firstCheck);
|
await page.waitToClick(selectors.ticketFuture.thirdCheck);
|
||||||
await page.waitToClick(selectors.ticketFuture.moveButton);
|
await page.waitToClick(selectors.ticketFuture.moveButton);
|
||||||
await page.waitToClick(selectors.ticketFuture.acceptButton);
|
await page.waitToClick(selectors.ticketFuture.acceptButton);
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toContain('Tickets moved successfully!');
|
expect(message.text).toContain('Tickets moved successfully!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show error trying to delete a ticket with a refund', async() => {
|
||||||
|
await page.waitToClick(selectors.ticketFuture.secondCheck);
|
||||||
|
await page.waitToClick(selectors.ticketFuture.moveButton);
|
||||||
|
await page.waitToClick(selectors.ticketFuture.acceptButton);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Tickets with associated refunds can\'t be deleted');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,4 +101,32 @@ describe('ticket setDeleted()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
headers: {origin: 'http://localhost:5000'},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.req.__ = value => {
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ticketId = 30;
|
||||||
|
await models.Ticket.setDeleted(ctx, ticketId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toContain('Tickets with associated refunds');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue