mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 14:38:20 +08:00
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
|
|
import chai = require('chai');
|
|
import chaiDateTime = require('chai-datetime');
|
|
|
|
chai.use(chaiDateTime);
|
|
const expect = chai.expect;
|
|
const assert = chai.assert;
|
|
|
|
function test_equalTime(){
|
|
const date: Date = new Date(2014, 1, 1);
|
|
expect(date).to.equalTime(date);
|
|
date.should.equalTime(date);
|
|
assert.equalTime(date, date);
|
|
}
|
|
|
|
function test_beforeTime(){
|
|
const date: Date = new Date(2014, 1, 1);
|
|
expect(date).to.be.beforeTime(date);
|
|
date.should.be.beforeTime(date);
|
|
assert.beforeTime(date, date);
|
|
}
|
|
|
|
function test_afterTime(){
|
|
const date: Date = new Date(2014, 1, 1);
|
|
expect(date).to.be.afterTime(date);
|
|
date.should.be.afterTime(date);
|
|
assert.afterTime(date, date);
|
|
}
|
|
|
|
function test_withinTime(){
|
|
const date: Date = new Date(2014, 7, 1);
|
|
const fromDate: Date = new Date(2014, 1, 1);
|
|
const toDate: Date = new Date(2015, 1, 1);
|
|
expect(date).to.be.withinTime(fromDate, toDate);
|
|
date.should.be.withinTime(fromDate, toDate);
|
|
assert.withinTime(date, fromDate, toDate);
|
|
}
|
|
|
|
function test_equalDate(){
|
|
const date: Date = new Date(2014, 1, 1);
|
|
expect(date).to.equalDate(date);
|
|
date.should.equalDate(date);
|
|
assert.equalDate(date, date);
|
|
}
|
|
|
|
function test_beforeDate(){
|
|
const date: Date = new Date(2014, 1, 1);
|
|
expect(date).to.be.beforeDate(date);
|
|
date.should.be.beforeDate(date);
|
|
assert.beforeDate(date, date);
|
|
}
|
|
|
|
function test_afterDate(){
|
|
const date: Date = new Date(2014, 1, 1);
|
|
expect(date).to.be.afterDate(date);
|
|
date.should.be.afterDate(date);
|
|
assert.afterDate(date, date);
|
|
}
|
|
|
|
function test_withinDate(){
|
|
const date: Date = new Date(2014, 7, 1);
|
|
const fromDate: Date = new Date(2014, 1, 1);
|
|
const toDate: Date = new Date(2015, 1, 1);
|
|
expect(date).to.be.withinDate(fromDate, toDate);
|
|
date.should.be.withinDate(fromDate, toDate);
|
|
assert.withinDate(date, fromDate, toDate);
|
|
}
|