@@ -64,6 +64,9 @@ If you've come here to help contribute - Thanks! Take a look at the [contributin
64
64
- [ .toBeValidDate()] ( #tobevaliddate )
65
65
- [ .toBeAfter(date)] ( #tobeafterdate )
66
66
- [ .toBeBefore(date)] ( #tobebeforedate )
67
+ - [ .toBeAfterOrEqualTo(date)] ( #tobeafterorequaltodate )
68
+ - [ .toBeBeforeOrEqualTo(date)] ( #tobebeforeorequaltodate )
69
+ - [ .toBeBetween(startDate, endDate)] ( #tobebetweenstartdate-enddate )
67
70
- Further proposals in [ #117 ] ( https://github.com/jest-community/jest-extended/issues/117 ) PRs welcome
68
71
- [ Function] ( #function )
69
72
- [ .toBeFunction()] ( #tobefunction )
@@ -462,6 +465,42 @@ test('passes when input is before date', () => {
462
465
});
463
466
```
464
467
468
+ ### .toBeAfterOrEqualTo(date)
469
+
470
+ Use ` .toBeAfterOrEqualTo ` when checking if a date equals to or occurs after ` date ` .
471
+
472
+ ``` js
473
+ test (' passes when input is equal to or after date' , () => {
474
+ expect (new Date (' 01/01/2019' )).toBeAfterOrEqualTo (new Date (' 01/01/2018' ));
475
+ expect (new Date (' 01/01/2019' )).toBeAfterOrEqualTo (new Date (' 01/01/2019' ));
476
+ expect (' 01/01/2018' ).not .toBeAfterOrEqualTo (new Date (' 01/01/2019' ));
477
+ });
478
+ ```
479
+
480
+ ### .toBeBeforeOrEqualTo(date)
481
+
482
+ Use ` .toBeBeforeOrEqualTo ` when checking if a date equals to or occurs before ` date ` .
483
+
484
+ ``` js
485
+ test (' passes when input is equal to or before date' , () => {
486
+ expect (new Date (' 01/01/2018' )).toBeBeforeOrEqualTo (new Date (' 01/01/2019' ));
487
+ expect (new Date (' 01/01/2018' )).toBeBeforeOrEqualTo (new Date (' 01/01/2018' ));
488
+ expect (' 01/01/2019' ).not .toBeBeforeOrEqualTo (new Date (' 01/01/2018' ));
489
+ });
490
+ ```
491
+
492
+ ### .toBeBetween(startDate, endDate)
493
+
494
+ Use ` .toBeBetween ` when checking if a date equals or occurs after ` startDate ` and equals or occurs before ` endDate ` .
495
+
496
+ ``` js
497
+ test (' passes when input is in given date range' , () => {
498
+ expect (new Date (' 05/01/2019' )).toBeBetween (new Date (' 01/01/2019' ), new Date (' 10/01/2019' );
499
+ expect (new Date (' 05/01/2019' )).toBeBetween (new Date (' 05/01/2019' ), new Date (' 10/01/2019' );
500
+ expect (new Date (' 01/01/2019' )).not .toBeBetween (new Date (' 05/01/2019' ), new Date (' 10/01/2019' ));
501
+ });
502
+ ` ` `
503
+
465
504
### Function
466
505
467
506
#### .toBeFunction()
0 commit comments