From b7075a42787d5950451cbd8f5406520d9c3ce920 Mon Sep 17 00:00:00 2001 From: Monil Bhavsar Date: Fri, 1 Dec 2023 14:06:52 +0530 Subject: [PATCH] Use lib methods and mimic well --- tests/unit/CalendarPickerTest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/CalendarPickerTest.js b/tests/unit/CalendarPickerTest.js index 92092acc4cd7..4e564b970832 100644 --- a/tests/unit/CalendarPickerTest.js +++ b/tests/unit/CalendarPickerTest.js @@ -1,5 +1,5 @@ import {fireEvent, render, within} from '@testing-library/react-native'; -import {addYears, subYears} from 'date-fns'; +import {addMonths, addYears, subYears} from 'date-fns'; import CalendarPicker from '../../src/components/NewDatePicker/CalendarPicker'; import CONST from '../../src/CONST'; import DateUtils from '../../src/libs/DateUtils'; @@ -64,7 +64,7 @@ describe('CalendarPicker', () => { fireEvent.press(getByTestId('next-month-arrow')); - const nextMonth = new Date().getMonth() + 1; + const nextMonth = addMonths(new Date(), 1).getMonth(); expect(getByText(monthNames[nextMonth])).toBeTruthy(); });