diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 6d88d53cb..e9b694159 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -4,6 +4,32 @@ CREATE SCHEMA IF NOT EXISTS `tmp`; UPDATE `util`.`config` SET `environment`= 'development'; +-- FOR MOCK vn.time + +DROP PROCEDURE IF EXISTS `vn`.`mockVnTime`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`mockVnTime`() +BEGIN + + DECLARE vDate DATE; + SET vDate = '2000-01-01'; + + WHILE ( YEAR(vDate) <= 2007 ) DO + INSERT IGNORE INTO vn.`time` (dated, period, `month`, `year`, `day`, week, yearMonth, salesYear) + VALUES (vDate, CONCAT(YEAR(vDate), (WEEK(vDate)+1)), MONTH(vDate), YEAR(vDate), DAY(vDate), WEEK(vDate)+1, CONCAT(YEAR(vDate), MONTH(vDate)), YEAR(vDate)); + + SET vDate = DATE_ADD(vDate, INTERVAL 1 DAY); + END WHILE; + +END$$ +DELIMITER ; + +CALL `vn`.`mockVnTime`(); +DROP PROCEDURE IF EXISTS `vn`.`mockVnTime`; +-- END MOCK vn.time + ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1; diff --git a/db/dump/mockDate.sql b/db/dump/mockDate.sql index 6452b38da..e9a81eb86 100644 --- a/db/dump/mockDate.sql +++ b/db/dump/mockDate.sql @@ -7,7 +7,7 @@ CREATE FUNCTION `util`.`mockedDate`() RETURNS DATETIME DETERMINISTIC BEGIN - RETURN '2000-06-15 11:00:00'; + RETURN '2001-01-01 11:00:00'; END ;; DELIMITER ; diff --git a/loopback/server/boot/date.js b/loopback/server/boot/date.js index e56393437..0875b6d5f 100644 --- a/loopback/server/boot/date.js +++ b/loopback/server/boot/date.js @@ -2,7 +2,7 @@ module.exports = () => { Date.vnUTC = () => { const env = process.env.NODE_ENV; if (!env || env === 'development') - return new Date(Date.UTC(2000, 5, 15, 11)); + return new Date(Date.UTC(2001, 0, 1, 11)); return new Date(Date.UTC()); }; diff --git a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js index a6117e68a..f5b06cc9e 100644 --- a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js +++ b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -fdescribe('Worker getWorkedHours()', () => { +describe('Worker getWorkedHours()', () => { it(`should return the expected hours and the worked hours of a given date`, async() => { const workerID = 1106; const started = Date.vnNew();