From 53d6d0033721be49dfb2ea289f343e1424b0c887 Mon Sep 17 00:00:00 2001 From: shiva Date: Thu, 26 Dec 2024 23:02:56 +0530 Subject: [PATCH] refactor:vitest to componenets/EventCalendar/* --- ...ventCalendar.test.tsx => EventCalendar.spec.tsx} | 3 ++- .../{EventHeader.test.tsx => EventHeader.spec.tsx} | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) rename src/components/EventCalendar/{EventCalendar.test.tsx => EventCalendar.spec.tsx} (99%) rename src/components/EventCalendar/{EventHeader.test.tsx => EventHeader.spec.tsx} (92%) diff --git a/src/components/EventCalendar/EventCalendar.test.tsx b/src/components/EventCalendar/EventCalendar.spec.tsx similarity index 99% rename from src/components/EventCalendar/EventCalendar.test.tsx rename to src/components/EventCalendar/EventCalendar.spec.tsx index 8e2395968a..4dfd0548d6 100644 --- a/src/components/EventCalendar/EventCalendar.test.tsx +++ b/src/components/EventCalendar/EventCalendar.spec.tsx @@ -13,6 +13,7 @@ import i18nForTest from 'utils/i18nForTest'; import { StaticMockLink } from 'utils/StaticMockLink'; import { weekdays, months } from './constants'; import { BrowserRouter as Router } from 'react-router-dom'; +import { vi } from 'vitest'; const eventData = [ { @@ -122,7 +123,7 @@ describe('Calendar', () => { }); afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it('should render the current month and year', () => { diff --git a/src/components/EventCalendar/EventHeader.test.tsx b/src/components/EventCalendar/EventHeader.spec.tsx similarity index 92% rename from src/components/EventCalendar/EventHeader.test.tsx rename to src/components/EventCalendar/EventHeader.spec.tsx index e18d066306..be1ba4bd78 100644 --- a/src/components/EventCalendar/EventHeader.test.tsx +++ b/src/components/EventCalendar/EventHeader.spec.tsx @@ -4,11 +4,20 @@ import EventHeader from './EventHeader'; import { ViewType } from '../../screens/OrganizationEvents/OrganizationEvents'; import { I18nextProvider } from 'react-i18next'; import i18nForTest from 'utils/i18nForTest'; +import { vi } from 'vitest'; describe('EventHeader Component', () => { const viewType = ViewType.MONTH; - const handleChangeView = jest.fn(); - const showInviteModal = jest.fn(); + + /** + * Mock function to handle view type changes. + */ + const handleChangeView = vi.fn(); + + /** + * Mock function to handle the display of the invite modal. + */ + const showInviteModal = vi.fn(); it('renders correctly', () => { const { getByTestId } = render(