From 84a51d3e8d0163ed7f83fa90d358922fc4366cc7 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 12 Jun 2024 12:23:37 +0200 Subject: [PATCH] feat: refs #6436 changed tests --- back/methods/collection/spec/setSaleQuantity.spec.js | 6 +++--- back/tests.js | 11 +++++++++-- back/vn-jasmine.js | 2 ++ loopback/common/methods/vn-model/specs/crud.spec.js | 6 +++--- .../methods/vn-model/specs/rewriteDbError.spec.js | 6 +++--- .../back/methods/claim/specs/regularizeClaim.spec.js | 6 +++--- .../methods/claim/specs/updateClaimAction.spec.js | 6 +++--- .../methods/client/specs/addressesPropagateRe.spec.js | 9 +++++---- .../back/methods/client/specs/createAddress.spec.js | 6 +++--- .../back/methods/client/specs/createWithUser.spec.js | 6 +++--- .../back/methods/client/specs/updateAddress.spec.js | 6 +++--- modules/client/back/models/specs/address.spec.js | 6 +++--- .../back/methods/entry/specs/addFromPackaging.spec.js | 6 +++--- .../back/methods/entry/specs/editLatestBuys.spec.js | 6 +++--- .../methods/entry/specs/importBuysPreview.spec.js | 6 +++--- .../back/methods/invoice-in-due-day/specs/new.spec.js | 6 +++--- .../item-shelving/specs/getAlternative.spec.js | 6 +++--- modules/item/back/methods/item/specs/clone.spec.js | 6 +++--- .../item/back/methods/item/specs/regularize.spec.js | 6 +++--- .../item/back/methods/item/specs/updateTaxes.spec.js | 6 +++--- modules/item/back/methods/tag/specs/onSubmit.spec.js | 6 +++--- modules/order/back/methods/order/specs/filter.spec.js | 9 ++++----- .../methods/agency-term/specs/createInvoiceIn.spec.js | 1 - modules/route/back/methods/route/specs/clone.spec.js | 6 +++--- .../back/methods/route/specs/guessPriority.spec.js | 11 ----------- .../back/methods/route/specs/updateWorkCenter.spec.js | 6 +++--- .../expedition/specs/deleteExpeditions.spec.js | 1 - .../ticket/back/methods/sale/specs/canEdit.spec.js | 6 +++--- modules/ticket/back/methods/sale/specs/clone.spec.js | 1 - .../back/methods/sale/specs/deleteSales.spec.js | 6 +++--- .../ticket/back/methods/sale/specs/reserve.spec.js | 6 +++--- .../back/methods/ticket-request/specs/confirm.spec.js | 6 +++--- .../back/methods/ticket-request/specs/deny.spec.js | 6 +++--- .../back/methods/ticket/specs/updateDiscount.spec.js | 6 +++--- .../ticket/back/models/specs/ticket-packaging.spec.js | 6 +++--- .../methods/travel/specs/createThermograph.spec.js | 6 +++--- modules/worker/back/methods/worker/specs/new.spec.js | 6 +++--- modules/zone/back/methods/zone/specs/clone.spec.js | 6 +++--- .../zone/back/methods/zone/specs/exclusionGeo.spec.js | 6 +++--- .../back/methods/zone/specs/toggleIsIncluded.spec.js | 6 +++--- 40 files changed, 116 insertions(+), 121 deletions(-) diff --git a/back/methods/collection/spec/setSaleQuantity.spec.js b/back/methods/collection/spec/setSaleQuantity.spec.js index 7abcda36b..e26e25115 100644 --- a/back/methods/collection/spec/setSaleQuantity.spec.js +++ b/back/methods/collection/spec/setSaleQuantity.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('setSaleQuantity()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should change quantity sale', async() => { const tx = await models.Ticket.beginTransaction({}); diff --git a/back/tests.js b/back/tests.js index 2e89cfd05..bfbe9e681 100644 --- a/back/tests.js +++ b/back/tests.js @@ -84,7 +84,10 @@ async function test() { 'loopback/**/*[sS]pec.js', 'modules/*/back/**/*.[sS]pec.js' ], - helpers: [`back/vn-jasmine.js`] + helpers: [`back/vn-jasmine.js`], + asyncHelpers: {miHelperAsync + + } }; if (PARALLEL) { @@ -114,10 +117,14 @@ async function test() { if (opts.ci) runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT; - // runner.loadConfigFile('back/jasmine.json'); runner.loadConfig(config); process.env.SPEC_IS_RUNNING = true; await runner.execute(); } test(); +function miHelperAsync() { + return new Promise((resolve, reject) => { + resolve('Resultado del helper'); + }); +} diff --git a/back/vn-jasmine.js b/back/vn-jasmine.js index 88dc55dc0..1c022637e 100644 --- a/back/vn-jasmine.js +++ b/back/vn-jasmine.js @@ -45,4 +45,6 @@ module.exports = { (function init() { vnBeforeAll(); + describe.$inject = () => { + }; })(); diff --git a/loopback/common/methods/vn-model/specs/crud.spec.js b/loopback/common/methods/vn-model/specs/crud.spec.js index d120db92a..a8923aed8 100644 --- a/loopback/common/methods/vn-model/specs/crud.spec.js +++ b/loopback/common/methods/vn-model/specs/crud.spec.js @@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server'); const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('Model crud()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); let insertId; const barcodeModel = app.models.ItemBarcode; diff --git a/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js b/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js index e3c24e74a..d89508383 100644 --- a/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js +++ b/loopback/common/methods/vn-model/specs/rewriteDbError.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('Model rewriteDbError()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should extend rewriteDbError properties to any model passed', () => { const exampleModel = models.ItemTag; diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 224adc997..879979829 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -40,9 +40,9 @@ describe('claim regularizeClaim()', () => { return await models.ClaimEnd.create(claimEnds, options); } - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should send a chat message with value "Trash" and then change claim state to resolved', async() => { const tx = await models.Claim.beginTransaction({}); diff --git a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js index c939f59de..506c80abb 100644 --- a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js @@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server'); const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('Update Claim', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); const newDate = Date.vnNew(); const original = { ticketFk: 3, diff --git a/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js b/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js index ec4ebe471..be2732bdb 100644 --- a/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js +++ b/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js @@ -2,11 +2,12 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('Client addressesPropagateRe', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); - it('should propagate the isEqualizated on both addresses of Mr Wayne and set hasToInvoiceByAddress to false', async() => { + it('should propagate the isEqualizated on both addresses of Mr Wayne' + + ' and set hasToInvoiceByAddress to false', async() => { const tx = await models.Client.beginTransaction({}); try { diff --git a/modules/client/back/methods/client/specs/createAddress.spec.js b/modules/client/back/methods/client/specs/createAddress.spec.js index 0556ce2cf..9c827a40e 100644 --- a/modules/client/back/methods/client/specs/createAddress.spec.js +++ b/modules/client/back/methods/client/specs/createAddress.spec.js @@ -7,9 +7,9 @@ describe('Address createAddress', () => { const incotermsFk = 'FAS'; const customAgentOneId = 1; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should throw a non uee member error if no incoterms is defined', async() => { const tx = await models.Client.beginTransaction({}); diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index cee8e0b38..47f2d34ce 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -16,9 +16,9 @@ describe('Client Create', () => { const newAccountWithoutEmail = JSON.parse(JSON.stringify(newAccount)); delete newAccountWithoutEmail.email; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it(`should not find deadpool as he's not created yet`, async() => { const tx = await models.Client.beginTransaction({}); diff --git a/modules/client/back/methods/client/specs/updateAddress.spec.js b/modules/client/back/methods/client/specs/updateAddress.spec.js index dd5142af0..d0c5e4d88 100644 --- a/modules/client/back/methods/client/specs/updateAddress.spec.js +++ b/modules/client/back/methods/client/specs/updateAddress.spec.js @@ -14,9 +14,9 @@ describe('Address updateAddress', () => { } }; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should throw the non uee member error if no incoterms is defined', async() => { const tx = await models.Client.beginTransaction({}); diff --git a/modules/client/back/models/specs/address.spec.js b/modules/client/back/models/specs/address.spec.js index 4baa1bdca..d390d045c 100644 --- a/modules/client/back/models/specs/address.spec.js +++ b/modules/client/back/models/specs/address.spec.js @@ -5,9 +5,9 @@ describe('loopback model address', () => { let createdAddressId; const clientId = 1101; - beforeAll(() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); afterAll(async() => { const client = await models.Client.findById(clientId); diff --git a/modules/entry/back/methods/entry/specs/addFromPackaging.spec.js b/modules/entry/back/methods/entry/specs/addFromPackaging.spec.js index 21940d57e..865e59bca 100644 --- a/modules/entry/back/methods/entry/specs/addFromPackaging.spec.js +++ b/modules/entry/back/methods/entry/specs/addFromPackaging.spec.js @@ -7,9 +7,9 @@ describe('entry addFromPackaging()', () => { const yesterday = new Date(today); yesterday.setDate(today.getDate() - 1); - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should create an incoming travel', async() => { const ctx = {accessToken: {userId: 49}, args: {isTravelReception: true, supplier}}; diff --git a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js index bff758eea..04c38078b 100644 --- a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('Buy editLatestsBuys()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should change the value of a given column for the selected buys', async() => { const tx = await models.Buy.beginTransaction({}); diff --git a/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js b/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js index bab46ad59..57adaf2dd 100644 --- a/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js +++ b/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js @@ -3,9 +3,9 @@ const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('entry importBuysPreview()', () => { const entryId = 1; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should return the buys with the calculated packagingFk', async() => { const tx = await models.Entry.beginTransaction({}); diff --git a/modules/invoiceIn/back/methods/invoice-in-due-day/specs/new.spec.js b/modules/invoiceIn/back/methods/invoice-in-due-day/specs/new.spec.js index 02a43d4af..9a996d103 100644 --- a/modules/invoiceIn/back/methods/invoice-in-due-day/specs/new.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in-due-day/specs/new.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('invoiceInDueDay new()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should correctly create a new due day', async() => { const userId = 9; diff --git a/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js b/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js index 3082cabd1..006842eca 100644 --- a/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js +++ b/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js @@ -2,9 +2,9 @@ const {models} = require('vn-loopback/server/server'); const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('itemShelving getAlternative()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should return a list of items without alternatives', async() => { const shelvingFk = 'HEJ'; diff --git a/modules/item/back/methods/item/specs/clone.spec.js b/modules/item/back/methods/item/specs/clone.spec.js index 1a479cd84..e252c910c 100644 --- a/modules/item/back/methods/item/specs/clone.spec.js +++ b/modules/item/back/methods/item/specs/clone.spec.js @@ -3,9 +3,9 @@ const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('item clone()', () => { let nextItemId; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); beforeEach(async() => { let query = `SELECT i1.id + 1 as id FROM vn.item i1 diff --git a/modules/item/back/methods/item/specs/regularize.spec.js b/modules/item/back/methods/item/specs/regularize.spec.js index b61dec995..097d61d5c 100644 --- a/modules/item/back/methods/item/specs/regularize.spec.js +++ b/modules/item/back/methods/item/specs/regularize.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('regularize()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should create a new ticket and add a line', async() => { const tx = await models.Item.beginTransaction({}); diff --git a/modules/item/back/methods/item/specs/updateTaxes.spec.js b/modules/item/back/methods/item/specs/updateTaxes.spec.js index 49f95c1ed..3d0f1ce33 100644 --- a/modules/item/back/methods/item/specs/updateTaxes.spec.js +++ b/modules/item/back/methods/item/specs/updateTaxes.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('item updateTaxes()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should throw an error if the taxClassFk is blank', async() => { const tx = await models.Item.beginTransaction({}); diff --git a/modules/item/back/methods/tag/specs/onSubmit.spec.js b/modules/item/back/methods/tag/specs/onSubmit.spec.js index 1830aafcf..be77b0248 100644 --- a/modules/item/back/methods/tag/specs/onSubmit.spec.js +++ b/modules/item/back/methods/tag/specs/onSubmit.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('tag onSubmit()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should delete a tag', async() => { const tx = await models.Item.beginTransaction({}); diff --git a/modules/order/back/methods/order/specs/filter.spec.js b/modules/order/back/methods/order/specs/filter.spec.js index 68de7fe04..a2ec88577 100644 --- a/modules/order/back/methods/order/specs/filter.spec.js +++ b/modules/order/back/methods/order/specs/filter.spec.js @@ -1,11 +1,10 @@ +const {mockLoopBackContext} = require('../../../../../../back/vn-jasmine'); + const models = require('vn-loopback/server/server').models; describe('order filter()', () => { - const ctx = { - req: {accessToken: {userId: 9}}, - args: {}, - params: {} - }; + let ctx; + beforeAll(() => ctx = mockLoopBackContext()); it('should call the filter method with a basic search', async() => { const myCtx = Object.assign({}, ctx); diff --git a/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js b/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js index a625605d2..dbe9d0e1e 100644 --- a/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js +++ b/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js @@ -1,5 +1,4 @@ const models = require('vn-loopback/server/server').models; -// const LoopBackContext = require('loopback-context'); describe('AgencyTerm createInvoiceIn()', () => { const {ctx} = beforeAll; diff --git a/modules/route/back/methods/route/specs/clone.spec.js b/modules/route/back/methods/route/specs/clone.spec.js index 98240488c..b9ad7751c 100644 --- a/modules/route/back/methods/route/specs/clone.spec.js +++ b/modules/route/back/methods/route/specs/clone.spec.js @@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server'); const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('route clone()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); const createdDate = Date.vnNew(); it('should throw an error if the amount of ids pased to the clone function do no match the database', async() => { diff --git a/modules/route/back/methods/route/specs/guessPriority.spec.js b/modules/route/back/methods/route/specs/guessPriority.spec.js index d73db6379..34fa510e1 100644 --- a/modules/route/back/methods/route/specs/guessPriority.spec.js +++ b/modules/route/back/methods/route/specs/guessPriority.spec.js @@ -1,18 +1,10 @@ const app = require('vn-loopback/server/server'); -// const LoopBackContext = require('loopback-context'); describe('route guessPriority()', () => { const targetRouteId = 7; let routeTicketsToRestore; - const {ctx} = beforeAll; - // beforeAll(() => { - // spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ - // active: activeCtx - // }); - // }); - afterAll(async() => { let restoreFixtures = []; routeTicketsToRestore.forEach(ticket => { @@ -22,9 +14,6 @@ describe('route guessPriority()', () => { }); it('should call guessPriority() then check all tickets in that route have their priorities defined', async() => { - // const ctx = { - // req: activeCtx - // }; routeTicketsToRestore = await app.models.Ticket.find({where: {routeFk: targetRouteId}}); await app.models.Route.guessPriority(ctx, targetRouteId); diff --git a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js index 315460d4a..4d5fbcbdc 100644 --- a/modules/route/back/methods/route/specs/updateWorkCenter.spec.js +++ b/modules/route/back/methods/route/specs/updateWorkCenter.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('route updateWorkCenter()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); const routeId = 1; it('should set the commission work center if the worker has workCenter', async() => { diff --git a/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js b/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js index b72334142..4134b28b8 100644 --- a/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js +++ b/modules/ticket/back/methods/expedition/specs/deleteExpeditions.spec.js @@ -1,5 +1,4 @@ const models = require('vn-loopback/server/server').models; -// const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('ticket deleteExpeditions()', () => { const {ctx} = beforeAll; diff --git a/modules/ticket/back/methods/sale/specs/canEdit.spec.js b/modules/ticket/back/methods/sale/specs/canEdit.spec.js index 3185b01e7..668b1c273 100644 --- a/modules/ticket/back/methods/sale/specs/canEdit.spec.js +++ b/modules/ticket/back/methods/sale/specs/canEdit.spec.js @@ -3,9 +3,9 @@ const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('sale canEdit()', () => { const employeeId = 1; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); describe('sale not exists', () => { it('should return error if sale not exists', async() => { diff --git a/modules/ticket/back/methods/sale/specs/clone.spec.js b/modules/ticket/back/methods/sale/specs/clone.spec.js index e2220c028..8767c2857 100644 --- a/modules/ticket/back/methods/sale/specs/clone.spec.js +++ b/modules/ticket/back/methods/sale/specs/clone.spec.js @@ -14,7 +14,6 @@ describe('Ticket cloning - clone function', () => { }, args: {} }; - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: ctx.req }); diff --git a/modules/ticket/back/methods/sale/specs/deleteSales.spec.js b/modules/ticket/back/methods/sale/specs/deleteSales.spec.js index 8d0e4bd4e..8dc261b13 100644 --- a/modules/ticket/back/methods/sale/specs/deleteSales.spec.js +++ b/modules/ticket/back/methods/sale/specs/deleteSales.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('sale deleteSales()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should throw an error if the ticket of the given sales is not editable', async() => { const tx = await models.Sale.beginTransaction({}); diff --git a/modules/ticket/back/methods/sale/specs/reserve.spec.js b/modules/ticket/back/methods/sale/specs/reserve.spec.js index 37ebf10ab..009d7b711 100644 --- a/modules/ticket/back/methods/sale/specs/reserve.spec.js +++ b/modules/ticket/back/methods/sale/specs/reserve.spec.js @@ -10,9 +10,9 @@ describe('sale reserve()', () => { } }; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should throw an error if the ticket can not be modified', async() => { const tx = await models.Sale.beginTransaction({}); diff --git a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js index 8a1130e7d..396834df2 100644 --- a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('ticket-request confirm()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it(`should throw an error if the item doesn't exist`, async() => { const tx = await models.TicketRequest.beginTransaction({}); diff --git a/modules/ticket/back/methods/ticket-request/specs/deny.spec.js b/modules/ticket/back/methods/ticket-request/specs/deny.spec.js index 1259f1284..aef07bd1b 100644 --- a/modules/ticket/back/methods/ticket-request/specs/deny.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/deny.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('ticket-request deny()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should return the denied ticket request', async() => { const tx = await models.TicketRequest.beginTransaction({}); diff --git a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js index c0c5333ba..01e6e64bb 100644 --- a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('sale updateDiscount()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); const originalSaleId = 8; it('should throw an error if no sales were selected', async() => { diff --git a/modules/ticket/back/models/specs/ticket-packaging.spec.js b/modules/ticket/back/models/specs/ticket-packaging.spec.js index 97a936018..7ff863cff 100644 --- a/modules/ticket/back/models/specs/ticket-packaging.spec.js +++ b/modules/ticket/back/models/specs/ticket-packaging.spec.js @@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server'); const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('ticket model TicketTracking', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); let ticketTrackingId; afterAll(async() => { diff --git a/modules/travel/back/methods/travel/specs/createThermograph.spec.js b/modules/travel/back/methods/travel/specs/createThermograph.spec.js index 9c93d6d52..2b0ae48f4 100644 --- a/modules/travel/back/methods/travel/specs/createThermograph.spec.js +++ b/modules/travel/back/methods/travel/specs/createThermograph.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('Travel createThermograph()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); const travelId = 3; const currentUserId = 1102; const thermographId = '138350-0'; diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js index b16efb16a..04540b9b7 100644 --- a/modules/worker/back/methods/worker/specs/new.spec.js +++ b/modules/worker/back/methods/worker/specs/new.spec.js @@ -10,9 +10,9 @@ describe('Worker new', () => { let tx; let opts; - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); describe('should return error', () => { beforeEach(async() => { diff --git a/modules/zone/back/methods/zone/specs/clone.spec.js b/modules/zone/back/methods/zone/specs/clone.spec.js index 465abdc9c..292aeb2ac 100644 --- a/modules/zone/back/methods/zone/specs/clone.spec.js +++ b/modules/zone/back/methods/zone/specs/clone.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('agency clone()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should clone a zone', async() => { const tx = await models.Zone.beginTransaction({}); diff --git a/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js b/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js index 746be502f..dc2eeb8a8 100644 --- a/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js +++ b/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('zone exclusionGeo()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); const zoneId = 1; const today = Date.vnNew(); diff --git a/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js b/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js index 39986498e..480c8b7ef 100644 --- a/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js +++ b/modules/zone/back/methods/zone/specs/toggleIsIncluded.spec.js @@ -2,9 +2,9 @@ const models = require('vn-loopback/server/server').models; const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine'); describe('zone toggleIsIncluded()', () => { - beforeAll(async() => { - mockLoopBackContext(); - }); + beforeAll(() => + mockLoopBackContext() + ); it('should return the created location with isIncluded true', async() => { const tx = await models.Zone.beginTransaction({});