From df073094f83a02d0cb362899ffa9d9da49d174c0 Mon Sep 17 00:00:00 2001 From: bernat Date: Tue, 26 Jan 2021 09:07:00 +0100 Subject: [PATCH] fix test updateVolume --- .../route/back/methods/route/specs/updateVolume.spec.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js index 162be92b2..e50a2ba00 100644 --- a/modules/route/back/methods/route/specs/updateVolume.spec.js +++ b/modules/route/back/methods/route/specs/updateVolume.spec.js @@ -1,8 +1,7 @@ const app = require('vn-loopback/server/server'); const LoopBackContext = require('loopback-context'); -// #2735 route updateVolume() returns inconsistent values -xdescribe('route updateVolume()', () => { +describe('route updateVolume()', () => { const routeId = 1; const userId = 50; const activeCtx = { @@ -19,7 +18,6 @@ xdescribe('route updateVolume()', () => { expect(route.m3).toEqual(1.8); const ticket = await app.models.Ticket.findById(14); - await ticket.updateAttributes({routeFk: routeId}); await app.models.Route.updateVolume(ctx, routeId); @@ -30,7 +28,8 @@ xdescribe('route updateVolume()', () => { const logs = await app.models.RouteLog.find({fields: ['id', 'newInstance']}); const m3Log = logs.filter(log => { - return log.newInstance.m3 === updatedRoute.m3; + if (log.newInstance) + return log.newInstance.m3 === updatedRoute.m3; }); const logIdToDestroy = m3Log[0].id;