diff --git a/modules/client/back/methods/client/specs/canBeInvoiced.spec.js b/modules/client/back/methods/client/specs/canBeInvoiced.spec.js index 7b0640d2a..2f11d8013 100644 --- a/modules/client/back/methods/client/specs/canBeInvoiced.spec.js +++ b/modules/client/back/methods/client/specs/canBeInvoiced.spec.js @@ -8,12 +8,10 @@ describe('client canBeInvoiced()', () => { accessToken: {userId: userId} }; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should return falsy for a client without the data checked', async() => { diff --git a/modules/client/back/models/specs/address.spec.js b/modules/client/back/models/specs/address.spec.js index 3271c7d8f..cae18258f 100644 --- a/modules/client/back/models/specs/address.spec.js +++ b/modules/client/back/models/specs/address.spec.js @@ -4,13 +4,11 @@ describe('loopback model address', () => { let createdAddressId; const clientId = 1101; - afterAll(async done => { + afterAll(async() => { let client = await app.models.Client.findById(clientId); await app.models.Address.destroyById(createdAddressId); await client.updateAttribute('isEqualizated', false); - - done(); }); describe('observe()', () => { diff --git a/modules/entry/back/methods/entry/specs/importBuys.spec.js b/modules/entry/back/methods/entry/specs/importBuys.spec.js index 942ce0a0b..467c21e90 100644 --- a/modules/entry/back/methods/entry/specs/importBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/importBuys.spec.js @@ -10,12 +10,10 @@ describe('entry import()', () => { accessToken: {userId: buyerId}, }; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should import the buy rows', async() => { diff --git a/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js b/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js index d286993ad..e62272c15 100644 --- a/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js +++ b/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js @@ -3,12 +3,10 @@ const LoopBackContext = require('loopback-context'); describe('entry importBuysPreview()', () => { const entryId = 1; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should return the buys with the calculated packageFk', async() => { diff --git a/modules/order/back/methods/order-row/specs/addToOrder.spec.js b/modules/order/back/methods/order-row/specs/addToOrder.spec.js index 3b832dee2..6e937176d 100644 --- a/modules/order/back/methods/order-row/specs/addToOrder.spec.js +++ b/modules/order/back/methods/order-row/specs/addToOrder.spec.js @@ -3,10 +3,8 @@ const app = require('vn-loopback/server/server'); describe('order addToOrder()', () => { const orderId = 8; let rowToDelete; - afterAll(async done => { + afterAll(async() => { await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: orderId}); - - done(); }); it('should add a row to a given order', async() => { diff --git a/modules/order/back/methods/order-row/specs/removes.spec.js b/modules/order/back/methods/order-row/specs/removes.spec.js index 1c68c6052..510676aa0 100644 --- a/modules/order/back/methods/order-row/specs/removes.spec.js +++ b/modules/order/back/methods/order-row/specs/removes.spec.js @@ -4,12 +4,10 @@ describe('order removes()', () => { let row; let newRow; - beforeAll(async done => { + beforeAll(async() => { row = await app.models.OrderRow.findOne({where: {id: 12}}); row.id = null; newRow = await app.models.OrderRow.create(row); - - done(); }); it('should throw an error if rows property is empty', async() => { diff --git a/modules/order/back/methods/order/specs/new.spec.js b/modules/order/back/methods/order/specs/new.spec.js index 84e33b779..8caed2452 100644 --- a/modules/order/back/methods/order/specs/new.spec.js +++ b/modules/order/back/methods/order/specs/new.spec.js @@ -4,10 +4,8 @@ let UserError = require('vn-loopback/util/user-error'); describe('order new()', () => { let orderId; - afterAll(async done => { + afterAll(async() => { await app.models.Order.destroyById(orderId); - - done(); }); it('should throw an error if the client isnt active', async() => { diff --git a/modules/order/back/methods/order/specs/updateBasicData.spec.js b/modules/order/back/methods/order/specs/updateBasicData.spec.js index 5e83d69a0..adf009bc1 100644 --- a/modules/order/back/methods/order/specs/updateBasicData.spec.js +++ b/modules/order/back/methods/order/specs/updateBasicData.spec.js @@ -2,12 +2,10 @@ const app = require('vn-loopback/server/server'); describe('Order updateBasicData', () => { const orderId = 21; - afterAll(async done => { + afterAll(async() => { let validparams = {note: null}; await app.models.Order.updateBasicData(orderId, validparams); - - done(); }); it('should return an error if the order is confirmed', async() => { diff --git a/modules/route/back/methods/route/specs/guessPriority.spec.js b/modules/route/back/methods/route/specs/guessPriority.spec.js index 4e70d727e..892324acf 100644 --- a/modules/route/back/methods/route/specs/guessPriority.spec.js +++ b/modules/route/back/methods/route/specs/guessPriority.spec.js @@ -4,14 +4,12 @@ describe('route guessPriority()', () => { const targetRouteId = 7; let routeTicketsToRestore; - afterAll(async done => { + afterAll(async() => { let restoreFixtures = []; routeTicketsToRestore.forEach(ticket => { restoreFixtures.push(ticket.updateAttribute('priority', null)); }); await Promise.all(restoreFixtures); - - done(); }); it('should call guessPriority() and then check the tickets in the target route now have their priorities defined', async() => { diff --git a/modules/route/back/methods/route/specs/insertTicket.spec.js b/modules/route/back/methods/route/specs/insertTicket.spec.js index 9e7806496..7c60e755f 100644 --- a/modules/route/back/methods/route/specs/insertTicket.spec.js +++ b/modules/route/back/methods/route/specs/insertTicket.spec.js @@ -8,12 +8,10 @@ describe('route insertTicket()', () => { accessToken: {userId: deliveryId}, }; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should add the ticket to a route', async() => { diff --git a/modules/supplier/back/models/specs/supplier.spec.js b/modules/supplier/back/models/specs/supplier.spec.js index f7dd15139..c3c99e676 100644 --- a/modules/supplier/back/models/specs/supplier.spec.js +++ b/modules/supplier/back/models/specs/supplier.spec.js @@ -4,18 +4,14 @@ describe('loopback model Supplier', () => { let supplierOne; let supplierTwo; - beforeAll(async done => { + beforeAll(async() => { supplierOne = await app.models.Supplier.findById(1); supplierTwo = await app.models.Supplier.findById(442); - - done(); }); - afterAll(async done => { + afterAll(async() => { await supplierOne.updateAttribute('payMethodFk', supplierOne.payMethodFk); await supplierTwo.updateAttribute('payMethodFk', supplierTwo.payMethodFk); - - done(); }); describe('payMethodFk', () => { diff --git a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js index 6bee334e4..746e1b7fc 100644 --- a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js +++ b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js @@ -30,12 +30,10 @@ describe('ticket changeState()', () => { agencyModeFk: 7 }; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should throw if the ticket is not editable and the user isnt production', async() => { diff --git a/modules/ticket/back/methods/ticket-tracking/specs/setDelivered.spec.js b/modules/ticket/back/methods/ticket-tracking/specs/setDelivered.spec.js index 80c6055e5..3d37221c4 100644 --- a/modules/ticket/back/methods/ticket-tracking/specs/setDelivered.spec.js +++ b/modules/ticket/back/methods/ticket-tracking/specs/setDelivered.spec.js @@ -7,11 +7,10 @@ describe('ticket setDelivered()', () => { accessToken: {userId: userId}, }; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - done(); }); it('should return the state which has been applied to the given tickets', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js index 05853acba..43f5b93df 100644 --- a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js +++ b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js @@ -8,12 +8,10 @@ describe('ticket canBeInvoiced()', () => { accessToken: {userId: userId} }; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should return falsy for an already invoiced ticket', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js index 36fc6732b..24d4a48ba 100644 --- a/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js +++ b/modules/ticket/back/methods/ticket/specs/makeInvoice.spec.js @@ -11,12 +11,10 @@ describe('ticket makeInvoice()', () => { }; const ctx = {req: activeCtx}; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); - - done(); }); it('should throw an error when invoicing tickets from multiple clients', async() => { diff --git a/modules/ticket/back/models/specs/ticket-packaging.spec.js b/modules/ticket/back/models/specs/ticket-packaging.spec.js index 893e0fb96..f2834643d 100644 --- a/modules/ticket/back/models/specs/ticket-packaging.spec.js +++ b/modules/ticket/back/models/specs/ticket-packaging.spec.js @@ -3,10 +3,8 @@ const app = require('vn-loopback/server/server'); describe('ticket model TicketTracking', () => { let ticketTrackingId; - afterAll(async done => { + afterAll(async() => { await app.models.TicketPackaging.destroyById(ticketTrackingId); - - done(); }); it('should save a ticketTraing as the quantity is greater than 0', async() => { diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js index 1990072f6..b4bfecbfb 100644 --- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js @@ -9,7 +9,7 @@ xdescribe('Travel cloneWithEntries()', () => { let travelBefore; let newTravelId; - afterAll(async done => { + afterAll(async() => { try { const entries = await models.Entry.find({ where: { @@ -44,8 +44,6 @@ xdescribe('Travel cloneWithEntries()', () => { } catch (error) { console.error(error); } - - done(); }); it(`should clone the travel and the containing entries`, async() => { diff --git a/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js b/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js index 215dd9a35..7dc7555d9 100644 --- a/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js +++ b/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js @@ -10,7 +10,7 @@ describe('Travel deleteThermograph()', () => { const ctx = {req: {accessToken: {userId: currentUserId}}}; let travelThermographBefore; - afterAll(async done => { + afterAll(async() => { await app.models.TravelThermograph.rawSql(` UPDATE travelThermograph SET travelFk = ?, dmsFk = ? @@ -19,8 +19,6 @@ describe('Travel deleteThermograph()', () => { travelThermographBefore.dmsFk, travelThermographBefore.id ]); - - done(); }); it(`should set the travelFk and dmsFk properties to null for travel thermograph removal`, async() => { diff --git a/modules/worker/back/methods/department/specs/createChild.spec.js b/modules/worker/back/methods/department/specs/createChild.spec.js index 305732f58..51891a6bf 100644 --- a/modules/worker/back/methods/department/specs/createChild.spec.js +++ b/modules/worker/back/methods/department/specs/createChild.spec.js @@ -3,9 +3,8 @@ const app = require('vn-loopback/server/server'); describe('department createChild()', () => { let createdChild; - afterAll(async done => { + afterAll(async() => { await createdChild.destroy(); - done(); }); it('should create a new child', async() => { diff --git a/modules/worker/back/methods/department/specs/moveChild.spec.js b/modules/worker/back/methods/department/specs/moveChild.spec.js index 3358ebf77..ca31784e8 100644 --- a/modules/worker/back/methods/department/specs/moveChild.spec.js +++ b/modules/worker/back/methods/department/specs/moveChild.spec.js @@ -3,10 +3,9 @@ const app = require('vn-loopback/server/server'); describe('department moveChild()', () => { let updatedChild; - afterAll(async done => { + afterAll(async() => { const child = await app.models.Department.findById(updatedChild.id); await child.updateAttribute('parentFk', null); - done(); }); it('should move a child department to a new parent', async() => { diff --git a/modules/worker/back/methods/department/specs/removeChild.spec.js b/modules/worker/back/methods/department/specs/removeChild.spec.js index 1fe3d10ef..d83e1b819 100644 --- a/modules/worker/back/methods/department/specs/removeChild.spec.js +++ b/modules/worker/back/methods/department/specs/removeChild.spec.js @@ -3,9 +3,8 @@ const app = require('vn-loopback/server/server'); describe('department removeChild()', () => { let removedChild; - afterAll(async done => { + afterAll(async() => { await app.models.Department.create(removedChild); - done(); }); it('should remove a child department', async() => { diff --git a/modules/zone/back/methods/zone/specs/deleteZone.spec.js b/modules/zone/back/methods/zone/specs/deleteZone.spec.js index 5dbfe0401..d8abe1da8 100644 --- a/modules/zone/back/methods/zone/specs/deleteZone.spec.js +++ b/modules/zone/back/methods/zone/specs/deleteZone.spec.js @@ -11,7 +11,7 @@ describe('zone deletezone()', () => { let ticketIDs; let originalTicketStates; - beforeAll(async done => { + beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); @@ -28,8 +28,6 @@ describe('zone deletezone()', () => { } catch (error) { console.error(error); } - - done(); }); it('should delete a zone and update their tickets', async() => {