From da80fee0e291a1bddc864a13ac635866fabaaf4d Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 9 Nov 2021 10:09:44 +0100 Subject: [PATCH] refactor(time-control): getWorkedHours.spec --- .../back/methods/worker/specs/getWorkedHours.spec.js | 12 ++++++------ modules/worker/front/time-control/index.js | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js index c06ff8502..3132a9003 100644 --- a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js +++ b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js @@ -1,17 +1,17 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; describe('Worker getWorkedHours()', () => { it(`should return the expected hours and the worked hours of a given date`, async() => { const workerID = 1106; - let started = new Date(); + const started = new Date(); started.setHours(0, 0, 0, 0); - let ended = new Date(); - ended.setHours(0, 0, 0, 0); + const ended = new Date(); + ended.setHours(23, 59, 59, 999); - const [result] = await app.models.Worker.getWorkedHours(workerID, started, ended); + const [result] = await models.Worker.getWorkedHours(workerID, started, ended); - expect(result.expectedHours).toEqual(28800); // 8:00 hours seconds + expect(result.expectedHours).toEqual(28800); // 8:00 hours in seconds expect(result.workedHours).toEqual(29400); // 8:10 hours in seconds }); }); diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index 4c0793933..96913c505 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -171,11 +171,9 @@ class Controller extends Section { from: from, to: to }; - console.log(from, to); const query = `Workers/${this.$params.id}/getWorkedHours`; return this.$http.get(query, {params}).then(res => { const workDays = res.data; - console.log(res.data); const map = new Map(); for (const workDay of workDays) {