back test priceDifference

This commit is contained in:
Joan Sanchez 2018-08-17 08:41:30 +02:00
parent 6e6cf47c5a
commit 4fff408e68
1 changed files with 7 additions and 7 deletions

View File

@ -1,17 +1,17 @@
const app = require(`${servicesDir}/ticket/server/server`);
describe('sale priceDifference()', () => {
it('should call the priceDifference method and return a NO_AGENCY_AVAILABLE signal error', done => {
it('should return ticket price differences', async() => {
let data = {
landed: Date.now(),
landed: new Date(),
addressFk: 121,
agencyModeFk: 1,
warehouseFk: 1
};
app.models.Sale.priceDifference(1, data)
.catch(response => {
expect(response).toEqual(new Error('ER_SIGNAL_EXCEPTION: NO_AGENCY_AVAILABLE'));
done();
});
let result = await app.models.Sale.priceDifference(1, data);
expect(result.totalUnitPrice).toEqual(60.5);
expect(result.totalNewPrice).toEqual(26.12);
expect(result.totalDifference).toEqual(202.80);
});
});