Skip to content

Commit

Permalink
fix: moment test case (binary-com#14409)
Browse files Browse the repository at this point in the history
  • Loading branch information
balakrishna-deriv committed Apr 1, 2024
1 parent 78f8434 commit 6ff7b26
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -22,9 +22,10 @@ describe('TwoMonthPicker', () => {
});
it('should call onChange when a date is selected', () => {
render(<TwoMonthPicker {...mockProps} />);
const prevMonthDate = screen.getAllByText(moment().format('D'))[0];
const prevMonthFullDate = moment().subtract(2, 'month').format('YYYY-MM-DD');
userEvent.click(prevMonthDate);
const prevMonthDate = moment().date(1).subtract(1, 'month');
const prevMonthDateElement = screen.getAllByText(prevMonthDate.date())[0];
const prevMonthFullDate = prevMonthDate.format('YYYY-MM-DD');
userEvent.click(prevMonthDateElement);
expect(mockProps.onChange).toHaveBeenCalledWith(moment.utc(prevMonthFullDate, 'YYYY-MM-DD'));
});
it('should jump to current month from previous months upon clicking today button', () => {
Expand Down

0 comments on commit 6ff7b26

Please sign in to comment.