mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Add missing methods withinX (#27176)
This commit is contained in:
committed by
Wesley Wigham
parent
3eca76c410
commit
64dc73c84c
@@ -3,47 +3,65 @@ import chai = require('chai');
|
||||
import chaiDateTime = require('chai-datetime');
|
||||
|
||||
chai.use(chaiDateTime);
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
const expect = chai.expect;
|
||||
const assert = chai.assert;
|
||||
|
||||
function test_equalTime(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
const date: Date = new Date(2014, 1, 1);
|
||||
expect(date).to.equalTime(date);
|
||||
date.should.equalTime(date);
|
||||
assert.equalTime(date, date);
|
||||
}
|
||||
|
||||
function test_beforeTime(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
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(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
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(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
const date: Date = new Date(2014, 1, 1);
|
||||
expect(date).to.equalDate(date);
|
||||
date.should.equalDate(date);
|
||||
assert.equalDate(date, date);
|
||||
}
|
||||
|
||||
function test_beforeDate(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
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(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
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);
|
||||
}
|
||||
|
||||
Vendored
+8
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for chai-datetime
|
||||
// Project: https://github.com/gaslight/chai-datetime.git
|
||||
// Definitions by: Cliff Burger <https://github.com/cliffburger>
|
||||
// Definitions by: Cliff Burger <https://github.com/cliffburger>,
|
||||
// Matt Bishop <https://github.com/mattbishop>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="chai" />
|
||||
@@ -14,9 +15,11 @@ declare global {
|
||||
afterDate(date: Date): Assertion;
|
||||
beforeDate(date: Date): Assertion;
|
||||
equalDate(date: Date): Assertion;
|
||||
withinDate(dateFrom: Date, dateTo: Date): Assertion;
|
||||
afterTime(date: Date): Assertion;
|
||||
beforeTime(date: Date): Assertion;
|
||||
equalTime(date: Date): Assertion;
|
||||
withinTime(dateFrom: Date, dateTo: Date): Assertion;
|
||||
}
|
||||
|
||||
interface Assert {
|
||||
@@ -26,12 +29,16 @@ declare global {
|
||||
notBeforeTime(val: Date, exp: Date, msg?: string): void;
|
||||
afterTime(val: Date, exp: Date, msg?: string): void;
|
||||
notAfterTime(val: Date, exp: Date, msg?: string): void;
|
||||
withinTime(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
|
||||
notWithinTime(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
|
||||
equalDate(val: Date, exp: Date, msg?: string): void;
|
||||
notEqualDate(val: Date, exp: Date, msg?: string): void;
|
||||
beforeDate(val: Date, exp: Date, msg?: string): void;
|
||||
notBeforeDate(val: Date, exp: Date, msg?: string): void;
|
||||
afterDate(val: Date, exp: Date, msg?: string): void;
|
||||
notAfterDate(val: Date, exp: Date, msg?: string): void;
|
||||
withinDate(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
|
||||
notWithinDate(val: Date, expFrom: Date, expTo: Date, msg?: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user