From 1e55632b940e1bad01e42c3c24ae4583119b5926 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 29 Sep 2020 13:28:02 +0200 Subject: [PATCH] refactor & fix regularize claim and prices Diff --- .../back/methods/claim/specs/regularizeClaim.spec.js | 9 +++------ .../back/methods/ticket/specs/priceDifference.spec.js | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 3098be157..55189bd9a 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,7 +1,6 @@ const app = require('vn-loopback/server/server'); -// #2457 fix regularizeClaim unit test -xdescribe('regularizeClaim()', () => { +describe('regularizeClaim()', () => { const claimFk = 1; const pendentState = 1; const resolvedState = 3; @@ -26,7 +25,6 @@ xdescribe('regularizeClaim()', () => { 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() => { const ctx = { req: { @@ -46,9 +44,8 @@ xdescribe('regularizeClaim()', () => { ticketFk: 1 }); - claimEnds.forEach(async claimEnd => { - claimEnd.updateAttributes({claimDestinationFk: trashDestination}); - }); + for (claimEnd of claimEnds) + await claimEnd.updateAttributes({claimDestinationFk: trashDestination}); let claimBefore = await app.models.Claim.findById(claimFk); await app.models.Claim.regularizeClaim(ctx, claimFk); diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index ea634a499..062be6b22 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -17,8 +17,7 @@ describe('sale priceDifference()', () => { let result = await app.models.Ticket.priceDifference(httpCtx, ticketId, landed, addressId, agencyModeId, zoneId, warehouseId); - expect(result.totalUnitPrice).toEqual(215.78); - expect(result.totalNewPrice).toEqual(215.78); + expect(result.totalUnitPrice).toEqual(result.totalNewPrice); expect(result.totalDifference).toEqual(0); });