From cd027a3e12811a6436a3e88fced0a4c838cc006d Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Wed, 31 Jan 2018 12:02:35 +0100 Subject: [PATCH] refactor to avoid using import on backend testing env --- services/auth/server/boot/specs/routes.spec.js | 6 +++--- .../client/common/methods/client/specs/addresses.spec.js | 4 ++-- .../methods/client/specs/addressesPropagateRe.spec.js | 6 +++--- services/client/common/methods/client/specs/card.spec.js | 4 ++-- services/client/common/methods/client/specs/create.spec.js | 6 +++--- .../client/common/methods/client/specs/employee.spec.js | 4 ++-- services/client/common/methods/client/specs/roles.spec.js | 4 ++-- .../client/common/methods/client/specs/salesperson.spec.js | 4 ++-- services/client/common/methods/greuge/specs/total.spec.js | 4 ++-- services/utils/jasmineHelpers.js | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/services/auth/server/boot/specs/routes.spec.js b/services/auth/server/boot/specs/routes.spec.js index ca5ca06e0..73215ad68 100644 --- a/services/auth/server/boot/specs/routes.spec.js +++ b/services/auth/server/boot/specs/routes.spec.js @@ -1,6 +1,6 @@ -let app = require('../../../server/server'); -let routes = require('../routes'); -let restoreFixtures = require('../../../../../services/db/testing_fixtures'); +const app = require('../../../server/server'); +const routes = require('../routes'); +const restoreFixtures = require('../../../../../services/db/testing_fixtures'); describe('Auth routes', () => { let fixturesToApply = {tables: ['`salix`.`user`'], inserts: [ diff --git a/services/client/common/methods/client/specs/addresses.spec.js b/services/client/common/methods/client/specs/addresses.spec.js index 809f80875..d679dff22 100644 --- a/services/client/common/methods/client/specs/addresses.spec.js +++ b/services/client/common/methods/client/specs/addresses.spec.js @@ -1,5 +1,5 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers'); describe('Client addresses', () => { it('should call the addressesList method and receive total results and items', done => { diff --git a/services/client/common/methods/client/specs/addressesPropagateRe.spec.js b/services/client/common/methods/client/specs/addressesPropagateRe.spec.js index d055cc86f..87a841def 100644 --- a/services/client/common/methods/client/specs/addressesPropagateRe.spec.js +++ b/services/client/common/methods/client/specs/addressesPropagateRe.spec.js @@ -1,6 +1,6 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); -let restoreFixtures = require('../../../../../../services/db/testing_fixtures'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; +const restoreFixtures = require('../../../../../../services/db/testing_fixtures'); describe('Client addressesPropagateRe', () => { let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [ diff --git a/services/client/common/methods/client/specs/card.spec.js b/services/client/common/methods/client/specs/card.spec.js index 895097cac..a7de41776 100644 --- a/services/client/common/methods/client/specs/card.spec.js +++ b/services/client/common/methods/client/specs/card.spec.js @@ -1,5 +1,5 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; describe('Client card', () => { it('should call the card() method to receive a formated card of Bruce Wayne', done => { diff --git a/services/client/common/methods/client/specs/create.spec.js b/services/client/common/methods/client/specs/create.spec.js index 9b6295483..15b3e000b 100644 --- a/services/client/common/methods/client/specs/create.spec.js +++ b/services/client/common/methods/client/specs/create.spec.js @@ -1,6 +1,6 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); -let restoreFixtures = require('../../../../../../services/db/testing_fixtures'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; +const restoreFixtures = require('../../../../../../services/db/testing_fixtures'); describe('Client Create', () => { let fixturesToApply = {tables: ['`account`.`user`', '`vn2008`.`Clientes`', '`vn2008`.`Consignatarios`'], inserts: [ diff --git a/services/client/common/methods/client/specs/employee.spec.js b/services/client/common/methods/client/specs/employee.spec.js index 04726aeb9..208956961 100644 --- a/services/client/common/methods/client/specs/employee.spec.js +++ b/services/client/common/methods/client/specs/employee.spec.js @@ -1,5 +1,5 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; describe('Client employeeList', () => { it('should call the employeeList()', done => { diff --git a/services/client/common/methods/client/specs/roles.spec.js b/services/client/common/methods/client/specs/roles.spec.js index b6ef8240c..a98c4c6f7 100644 --- a/services/client/common/methods/client/specs/roles.spec.js +++ b/services/client/common/methods/client/specs/roles.spec.js @@ -1,5 +1,5 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; describe('Client getRoleCustomer', () => { it('should call the getRoleCustomer() method with a customer id', done => { diff --git a/services/client/common/methods/client/specs/salesperson.spec.js b/services/client/common/methods/client/specs/salesperson.spec.js index c95b9bf52..a2688c9b4 100644 --- a/services/client/common/methods/client/specs/salesperson.spec.js +++ b/services/client/common/methods/client/specs/salesperson.spec.js @@ -1,5 +1,5 @@ -let app = require('../../../../server/server'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); +const app = require('../../../../server/server'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; describe('Client activeSalesPerson', () => { it('should call the activeSalesPerson() method with limit of 1', done => { diff --git a/services/client/common/methods/greuge/specs/total.spec.js b/services/client/common/methods/greuge/specs/total.spec.js index b088692fc..1646d9c38 100644 --- a/services/client/common/methods/greuge/specs/total.spec.js +++ b/services/client/common/methods/greuge/specs/total.spec.js @@ -1,5 +1,5 @@ -let totalGreuge = require('../total'); -let catchErrors = require('../../../../../../services/utils/jasmineHelpers'); +const totalGreuge = require('../total'); +const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; describe('Greuge totalGreuge()', () => { it('should call the sumAmount method', done => { diff --git a/services/utils/jasmineHelpers.js b/services/utils/jasmineHelpers.js index ab45069c3..fd0b82c5a 100644 --- a/services/utils/jasmineHelpers.js +++ b/services/utils/jasmineHelpers.js @@ -1,4 +1,4 @@ -module.exports = function catchErrors(done) { +module.exports.catchErrors = function(done) { return error => { if (error instanceof Error) { return done.fail(error.stack);