|
10 | 10 | * governing permissions and limitations under the License.
|
11 | 11 | */
|
12 | 12 |
|
13 |
| -import {BuddhistCalendar, CalendarDate, CopticCalendar, EthiopicAmeteAlemCalendar, EthiopicCalendar, HebrewCalendar, IndianCalendar, IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar, JapaneseCalendar, PersianCalendar, TaiwanCalendar} from '..'; |
| 13 | +import {BuddhistCalendar, CalendarDate, CalendarDateTime, CopticCalendar, EthiopicAmeteAlemCalendar, EthiopicCalendar, HebrewCalendar, IndianCalendar, IslamicCivilCalendar, IslamicTabularCalendar, IslamicUmalquraCalendar, JapaneseCalendar, PersianCalendar, TaiwanCalendar} from '..'; |
14 | 14 |
|
15 | 15 | describe('CalendarDate manipulation', function () {
|
16 | 16 | describe('add', function () {
|
@@ -682,3 +682,31 @@ describe('CalendarDate manipulation', function () {
|
682 | 682 | });
|
683 | 683 | });
|
684 | 684 | });
|
| 685 | + |
| 686 | +describe('CalendarDateTime manipulation', function () { |
| 687 | + describe('add', function () { |
| 688 | + it.each` |
| 689 | + Unit | Expected |
| 690 | + ${'hours'} | ${new CalendarDateTime(2020, 1, 1, 5, 0, 0, 0)} |
| 691 | + ${'minutes'} | ${new CalendarDateTime(2020, 1, 1, 0, 5, 0, 0)} |
| 692 | + ${'seconds'} | ${new CalendarDateTime(2020, 1, 1, 0, 0, 5, 0)} |
| 693 | + ${'milliseconds'} | ${new CalendarDateTime(2020, 1, 1, 0, 0, 0, 5)} |
| 694 | + `('should add $Unit', ({Unit, Expected}) => { |
| 695 | + let date = new CalendarDateTime(2020, 1, 1, 0, 0, 0, 0); |
| 696 | + expect(date.add({[`${Unit}`]: 5})).toEqual(Expected); |
| 697 | + }); |
| 698 | + }); |
| 699 | + |
| 700 | + describe('subtract', function () { |
| 701 | + it.each` |
| 702 | + Unit | Expected |
| 703 | + ${'hours'} | ${new CalendarDateTime(2020, 1, 1, 0, 5, 5, 5)} |
| 704 | + ${'minutes'} | ${new CalendarDateTime(2020, 1, 1, 5, 0, 5, 5)} |
| 705 | + ${'seconds'} | ${new CalendarDateTime(2020, 1, 1, 5, 5, 0, 5)} |
| 706 | + ${'milliseconds'} | ${new CalendarDateTime(2020, 1, 1, 5, 5, 5, 0)} |
| 707 | + `('should subtract $Unit', ({Unit, Expected}) => { |
| 708 | + let date = new CalendarDateTime(2020, 1, 1, 5, 5, 5, 5); |
| 709 | + expect(date.subtract({[`${Unit}`]: 5})).toEqual(Expected); |
| 710 | + }); |
| 711 | + }); |
| 712 | +}); |
0 commit comments