Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TT-39 fix: testing increment() and decrement()
  • Loading branch information
scastillo-jp authored and Guido Quezada committed Dec 28, 2020
commit 42aea4bebfc4a2e5aae33d543754e886e4d68758
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,27 @@ describe('MonthPickerComponent', () => {
});

it('should add a year to current year', () => {
const year = moment().add(1, 'year').format('Y');
expect(component.selectedYearMoment.add(1, 'year').format('Y')).toEqual(year);
expect(component.updateYearText).toBeTruthy();
component.selectedYearMoment = moment();
const incrementYear = moment().add(1, 'year').format('Y');
spyOn(component, 'increment').and.callThrough();

component.increment();

expect(component.increment).toHaveBeenCalled();
expect(component.selectedYearText).toEqual(incrementYear);
expect(component.selectedYearMoment.format('Y')).toEqual(incrementYear);
});


it('should subtract a year to current year', () => {
const year = moment().subtract(1, 'year').format('Y');
expect(component.selectedYearMoment.subtract(1, 'year').format('Y')).toEqual(year);
expect(component.updateYearText).toBeTruthy();
component.selectedYearMoment = moment();
const decrementYear = moment().subtract(1, 'year').format('Y');
spyOn(component, 'decrement').and.callThrough();

component.decrement();

expect(component.decrement).toHaveBeenCalled();
expect(component.selectedYearMoment.format('Y')).toEqual(decrementYear);
});

});