5043-mock_Date #1260

Merged
alexm merged 21 commits from 5043-mock_Date into dev 2023-02-03 10:57:51 +00:00
4 changed files with 29 additions and 3 deletions
Showing only changes of commit a74fb31b5b - Show all commits

View File

@ -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
alexm marked this conversation as resolved Outdated
Outdated
Review

Probar con hasta 2002

Probar con hasta 2002
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;

View File

@ -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 ;

View File

@ -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());
};

View File

@ -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();