half test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-12-15 15:16:21 +01:00
parent e01d676bb1
commit 3e91929d0d
1 changed files with 32 additions and 0 deletions

View File

@ -59,4 +59,36 @@ describe('sale priceDifference()', () => {
expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`)); 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;
}
});
}); });