3430-ticket_step-two ticket without negatives #823

Merged
joan merged 31 commits from 3430-ticket_step-two into dev 2022-02-01 08:34:41 +00:00
1 changed files with 32 additions and 0 deletions
Showing only changes of commit 3e91929d0d - Show all commits

View File

@ -59,4 +59,36 @@ describe('sale priceDifference()', () => {
expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`));
});
it('should return ticket visible', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const ctx = {req: {accessToken: {userId: 1106}}};
ctx.args = {
id: 11,
landed: tomorrow,
addressId: 122,
agencyModeId: 7,
zoneId: 3,
warehouseId: 1
};
const result = await models.Ticket.priceDifference(ctx, options);
console.log(result.items[0]);
expect(result.totalUnitPrice).toEqual(result.totalNewPrice);
expect(result.totalDifference).toEqual(0);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});