5043-mock_Date #1260

Merged
alexm merged 21 commits from 5043-mock_Date into dev 2023-02-03 10:57:51 +00:00
6 changed files with 33 additions and 31 deletions
Showing only changes of commit 8d33aa8454 - Show all commits

View File

@ -934,10 +934,10 @@ INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`,
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL), (7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL), (8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL), (9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
(10, 7, 7, 71, NOW(), 1, 18, NULL, 94, 3, NULL), (10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
(11, 7, 8, 71, NOW(), 1, 18, NULL, 94, 3, NULL), (11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
(12, 7, 9, 71, NOW(), 1, 18, NULL, 94, 3, NULL), (12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
(13, 1, 10,71, NOW(), 1, 18, NULL, 94, 3, NULL); (13, 1, 10,71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors'; import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Client balance path', () => { fdescribe('Client balance path', () => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {

View File

@ -1,3 +1,11 @@
Date.vnUTC = () => {
const env = process.env.NODE_ENV;
if (!env || env === 'development')
return new Date(Date.UTC(2022, 5, 15, 11));
return new Date(Date.UTC());
};
Date.vnNew = () => { Date.vnNew = () => {
return new Date(Date.vnUTC()); return new Date(Date.vnUTC());
}; };
@ -6,10 +14,3 @@ Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime(); return new Date(Date.vnUTC()).getTime();
}; };
Date.vnUTC = () => {
const env = process.env.NODE_ENV;
if (!env || env === 'development')
return new Date(Date.UTC(2022, 5, 15, 11));
return new Date(Date.UTC());
};

View File

@ -1,11 +1,3 @@
Date.vnNew = () => {
return new Date(Date.vnUTC());
};
Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime();
};
Date.vnUTC = () => { Date.vnUTC = () => {
const env = process.env.NODE_ENV; const env = process.env.NODE_ENV;
if (!env || env === 'development') if (!env || env === 'development')
@ -13,3 +5,11 @@ Date.vnUTC = () => {
return new Date(Date.UTC()); return new Date(Date.UTC());
}; };
Date.vnNew = () => {
return new Date(Date.vnUTC());
};
Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime();
};

View File

@ -36,16 +36,17 @@ window.ngModule = function(moduleName, ...args) {
if (args.length) if (args.length)
fns = fns.concat(args); fns = fns.concat(args);
Date.vnUTC = () => { Date.vnUTC = () => {
return new Date(Date.UTC(2000, 0, 1, 11)); return new Date(Date.UTC(2022, 5, 15, 11));
}; };
Date.vnNew = () => { Date.vnNew = () => {
return new Date(Date.UTC(2000, 0, 1, 11)); return new Date(Date.UTC(2022, 5, 15, 11));
}; };
Date.vnNow = () => { Date.vnNow = () => {
return new Date(Date.UTC(2000, 0, 1, 11)).getTime(); return new Date(Date.UTC(2022, 5, 15, 11)).getTime();
}; };
return angular.mock.module(...fns); return angular.mock.module(...fns);
}; };

View File

@ -1,12 +1,4 @@
module.exports = () => { module.exports = () => {
Date.vnNew = () => {
return new Date(Date.vnUTC());
};
Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime();
};
Date.vnUTC = () => { Date.vnUTC = () => {
const env = process.env.NODE_ENV; const env = process.env.NODE_ENV;
if (!env || env === 'development') if (!env || env === 'development')
@ -14,4 +6,12 @@ module.exports = () => {
return new Date(Date.UTC()); return new Date(Date.UTC());
}; };
Date.vnNew = () => {
return new Date(Date.vnUTC());
};
Date.vnNow = () => {
return new Date(Date.vnUTC()).getTime();
};
}; };