5043-mock_Date #1260
|
@ -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;
|
||||
|
|
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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());
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue