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
2 changed files with 21 additions and 3 deletions
Showing only changes of commit 87f994aa77 - Show all commits

View File

@ -80,10 +80,11 @@ describe('sale priceDifference()', () => {
}; };
const result = await models.Ticket.priceDifference(ctx, options); const result = await models.Ticket.priceDifference(ctx, options);
console.log(result.items[0]); const firstItem = result.items[0];
const secondtItem = result.items[1];
expect(result.totalUnitPrice).toEqual(result.totalNewPrice); expect(firstItem.visible).toEqual(445);
expect(result.totalDifference).toEqual(0); expect(secondtItem.visible).toEqual(1980);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {

View File

@ -64,5 +64,22 @@ describe('Ticket', () => {
expect(controller.totalPriceDifference).toEqual(0.3); expect(controller.totalPriceDifference).toEqual(0.3);
}); });
}); });
fdescribe('ticketHaveNegatives()', () => {
it('should show if ticket have any negative', () => {
controller.ticket = {
sale: {
items: [{
quantity: 2,
visible: 1
}]
}
};
controller.ticketHaveNegatives();
expect(controller.haveNegatives).toEqual(true);
});
});
}); });
}); });