refactor & fix regularize claim and prices Diff
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-09-29 13:28:02 +02:00
parent 40abd68734
commit 1e55632b94
2 changed files with 4 additions and 8 deletions

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// #2457 fix regularizeClaim unit test describe('regularizeClaim()', () => {
xdescribe('regularizeClaim()', () => {
const claimFk = 1; const claimFk = 1;
const pendentState = 1; const pendentState = 1;
const resolvedState = 3; const resolvedState = 3;
@ -26,7 +25,6 @@ xdescribe('regularizeClaim()', () => {
done(); done();
}); });
// #2457 fix regularizeClaim unit test (this one fails)
it('should send a chat message with value "Trash" and then change claim state to resolved', async() => { it('should send a chat message with value "Trash" and then change claim state to resolved', async() => {
const ctx = { const ctx = {
req: { req: {
@ -46,9 +44,8 @@ xdescribe('regularizeClaim()', () => {
ticketFk: 1 ticketFk: 1
}); });
claimEnds.forEach(async claimEnd => { for (claimEnd of claimEnds)
claimEnd.updateAttributes({claimDestinationFk: trashDestination}); await claimEnd.updateAttributes({claimDestinationFk: trashDestination});
});
let claimBefore = await app.models.Claim.findById(claimFk); let claimBefore = await app.models.Claim.findById(claimFk);
await app.models.Claim.regularizeClaim(ctx, claimFk); await app.models.Claim.regularizeClaim(ctx, claimFk);

View File

@ -17,8 +17,7 @@ describe('sale priceDifference()', () => {
let result = await app.models.Ticket.priceDifference(httpCtx, ticketId, landed, let result = await app.models.Ticket.priceDifference(httpCtx, ticketId, landed,
addressId, agencyModeId, zoneId, warehouseId); addressId, agencyModeId, zoneId, warehouseId);
expect(result.totalUnitPrice).toEqual(215.78); expect(result.totalUnitPrice).toEqual(result.totalNewPrice);
expect(result.totalNewPrice).toEqual(215.78);
expect(result.totalDifference).toEqual(0); expect(result.totalDifference).toEqual(0);
}); });