From 9090c56c64c1a65e523e30d4b2a2e2705d47341f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 31 Jan 2018 13:40:26 +0100 Subject: [PATCH] Backend tests fixed --- .../methods/client/specs/addressesPropagateRe.spec.js | 0 .../common/methods/client/specs/card.spec.js | 0 .../common/methods/client/specs/createWithUser.spec.js | 0 .../common/methods/client/specs/hasCustomerRole.spec.js | 0 .../common/methods/client/specs/listAddresses.spec.js | 0 .../common/methods/client/specs/listWorkers.spec.js | 8 ++++---- .../common/methods/client/specs/salesperson.spec.js | 0 .../greuge/specs/{total.spec.js => sumAmount.spec.js} | 2 +- services/loopback/server/server.js | 2 +- 9 files changed, 6 insertions(+), 6 deletions(-) rename services/{loopback => client}/common/methods/client/specs/addressesPropagateRe.spec.js (100%) rename services/{loopback => client}/common/methods/client/specs/card.spec.js (100%) rename services/{loopback => client}/common/methods/client/specs/createWithUser.spec.js (100%) rename services/{loopback => client}/common/methods/client/specs/hasCustomerRole.spec.js (100%) rename services/{loopback => client}/common/methods/client/specs/listAddresses.spec.js (100%) rename services/{loopback => client}/common/methods/client/specs/listWorkers.spec.js (70%) rename services/{loopback => client}/common/methods/client/specs/salesperson.spec.js (100%) rename services/client/common/methods/greuge/specs/{total.spec.js => sumAmount.spec.js} (93%) diff --git a/services/loopback/common/methods/client/specs/addressesPropagateRe.spec.js b/services/client/common/methods/client/specs/addressesPropagateRe.spec.js similarity index 100% rename from services/loopback/common/methods/client/specs/addressesPropagateRe.spec.js rename to services/client/common/methods/client/specs/addressesPropagateRe.spec.js diff --git a/services/loopback/common/methods/client/specs/card.spec.js b/services/client/common/methods/client/specs/card.spec.js similarity index 100% rename from services/loopback/common/methods/client/specs/card.spec.js rename to services/client/common/methods/client/specs/card.spec.js diff --git a/services/loopback/common/methods/client/specs/createWithUser.spec.js b/services/client/common/methods/client/specs/createWithUser.spec.js similarity index 100% rename from services/loopback/common/methods/client/specs/createWithUser.spec.js rename to services/client/common/methods/client/specs/createWithUser.spec.js diff --git a/services/loopback/common/methods/client/specs/hasCustomerRole.spec.js b/services/client/common/methods/client/specs/hasCustomerRole.spec.js similarity index 100% rename from services/loopback/common/methods/client/specs/hasCustomerRole.spec.js rename to services/client/common/methods/client/specs/hasCustomerRole.spec.js diff --git a/services/loopback/common/methods/client/specs/listAddresses.spec.js b/services/client/common/methods/client/specs/listAddresses.spec.js similarity index 100% rename from services/loopback/common/methods/client/specs/listAddresses.spec.js rename to services/client/common/methods/client/specs/listAddresses.spec.js diff --git a/services/loopback/common/methods/client/specs/listWorkers.spec.js b/services/client/common/methods/client/specs/listWorkers.spec.js similarity index 70% rename from services/loopback/common/methods/client/specs/listWorkers.spec.js rename to services/client/common/methods/client/specs/listWorkers.spec.js index 532d44aac..33222c4d8 100644 --- a/services/loopback/common/methods/client/specs/listWorkers.spec.js +++ b/services/client/common/methods/client/specs/listWorkers.spec.js @@ -3,13 +3,13 @@ const catchErrors = require('../../../../../../services/utils/jasmineHelpers').c describe('Client listWorkers', () => { it('should call the listWorkers()', done => { - let callback = (error, result) => { - if (error) return catchErrors(done)(error); + app.models.Client.listWorkers() + .then(result => { let amountOfEmployees = Object.keys(result).length; expect(amountOfEmployees).toEqual(6); done(); - }; - app.models.Client.listWorkers(callback); + }) + .catch(catchErrors(done)); }); }); diff --git a/services/loopback/common/methods/client/specs/salesperson.spec.js b/services/client/common/methods/client/specs/salesperson.spec.js similarity index 100% rename from services/loopback/common/methods/client/specs/salesperson.spec.js rename to services/client/common/methods/client/specs/salesperson.spec.js diff --git a/services/client/common/methods/greuge/specs/total.spec.js b/services/client/common/methods/greuge/specs/sumAmount.spec.js similarity index 93% rename from services/client/common/methods/greuge/specs/total.spec.js rename to services/client/common/methods/greuge/specs/sumAmount.spec.js index 1646d9c38..41339702a 100644 --- a/services/client/common/methods/greuge/specs/total.spec.js +++ b/services/client/common/methods/greuge/specs/sumAmount.spec.js @@ -1,4 +1,4 @@ -const totalGreuge = require('../total'); +const totalGreuge = require('../sumAmount'); const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; describe('Greuge totalGreuge()', () => { diff --git a/services/loopback/server/server.js b/services/loopback/server/server.js index 6ebd49760..2a4f74695 100644 --- a/services/loopback/server/server.js +++ b/services/loopback/server/server.js @@ -26,7 +26,7 @@ function vnBoot(app, rootDir, rootModule) { // View - let viewDir = path.join(rootDir, '../client'); + let viewDir = `${rootDir}/../client`; if (fs.existsSync(viewDir)) { app.set('view engine', 'ejs');