diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js index 5a52a13a1..046240555 100644 --- a/modules/route/back/methods/route/specs/updateVolume.spec.js +++ b/modules/route/back/methods/route/specs/updateVolume.spec.js @@ -6,10 +6,13 @@ describe('route updateVolume()', () => { const ctx = {req: {accessToken: {userId: workerFk}}}; let originalRoute; let ticketRestore; + let logIdToDestroy; + afterAll(async done => { await originalRoute.updateAttributes({m3: 0.2}); await ticketRestore.updateAttributes({routeFk: 4}); + await app.models.RouteLog.destroyById(logIdToDestroy); done(); }); @@ -30,15 +33,15 @@ describe('route updateVolume()', () => { expect(updatedRoute.m3).not.toEqual(originalRoute.m3); }); - // 1462 - xit('should confirm the change is logged ', async() => { - let instanceValue = {m3: 0.3}; - let filterValue = JSON.stringify(instanceValue); - let filter = {where: {newInstance: filterValue}}; - console.log(filter); - let routeLog = await app.models.RouteLog.find(filter); - console.log(routeLog); - expect(routeLog.length).toBeGreaterThan(0); + it('should confirm the change is logged', async() => { + let instanceValue = {m3: 0.3}; + let logs = await app.models.RouteLog.find({fields: ['id', 'newInstance']}); + let m3Log = logs.filter(log => { + return log.newInstance.m3 === instanceValue.m3; + }); + logIdToDestroy = m3Log[0].id; + + expect(m3Log.length).toEqual(1); }); });