3430-ticket_step-two ticket without negatives #823
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue