5043-mock_Date #1260
|
@ -4,6 +4,32 @@ CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||||
UPDATE `util`.`config`
|
UPDATE `util`.`config`
|
||||||
SET `environment`= 'development';
|
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
|
|||||||
|
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`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
|
ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
|
||||||
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
|
||||||
|
|
|
@ -7,7 +7,7 @@ CREATE FUNCTION `util`.`mockedDate`()
|
||||||
RETURNS DATETIME
|
RETURNS DATETIME
|
||||||
DETERMINISTIC
|
DETERMINISTIC
|
||||||
BEGIN
|
BEGIN
|
||||||
RETURN '2000-06-15 11:00:00';
|
RETURN '2001-01-01 11:00:00';
|
||||||
END ;;
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ module.exports = () => {
|
||||||
Date.vnUTC = () => {
|
Date.vnUTC = () => {
|
||||||
const env = process.env.NODE_ENV;
|
const env = process.env.NODE_ENV;
|
||||||
if (!env || env === 'development')
|
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());
|
return new Date(Date.UTC());
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
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() => {
|
it(`should return the expected hours and the worked hours of a given date`, async() => {
|
||||||
const workerID = 1106;
|
const workerID = 1106;
|
||||||
const started = Date.vnNew();
|
const started = Date.vnNew();
|
||||||
|
|
Loading…
Reference in New Issue
Probar con hasta 2002