31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
// import 'mocha';
|
|
// import { expect } from 'chai';
|
|
// import { getTimeFunD } from '../app/pubUtils/timeUtil';
|
|
|
|
// const millisecondsPerDay = 24 * 60 * 60 * 1000;
|
|
|
|
// function checkTime(date: Date, h: number, m: number, s: number) {
|
|
// expect(date.getHours()).to.be.equal(h);
|
|
// expect(date.getMinutes()).to.be.equal(m);
|
|
// expect(date.getSeconds()).to.be.equal(s);
|
|
// }
|
|
|
|
// describe('测试时间工具方法', function () {
|
|
// it('获取某个时间后的某点,返回当天', function () {
|
|
// const baseDate = new Date();
|
|
// const newHour = 9, newMin = 9, newSec = 9;
|
|
// baseDate.setHours(newHour - 1, 0, 0);
|
|
// const newDate = <Date>getTimeFunD(baseDate).getAfterDayWithHour(0, newHour, newMin, newSec);
|
|
// checkTime(newDate, newHour, newMin, newSec);
|
|
// expect(newDate.getDate()).to.be.equal(baseDate.getDate());
|
|
// });
|
|
|
|
// it('获取某个时间后的某点,返回后一天', function () {
|
|
// const baseDate = new Date();
|
|
// const newHour = 9, newMin = 9, newSec = 9;
|
|
// baseDate.setHours(newHour + 1, 0, 0);
|
|
// const newDate = <Date>getTimeFunD(baseDate).getAfterDayWithHour(0, newHour, newMin, newSec);
|
|
// checkTime(newDate, newHour, newMin, newSec);
|
|
// expect(newDate.getDate()).to.be.equal(new Date(baseDate.getTime() + millisecondsPerDay).getDate());
|
|
// });
|
|
// });
|