From 9fdba79430e2214fe65526a1a8e020bcf5ef688e Mon Sep 17 00:00:00 2001 From: Shiva <148421597+shivasankaran18@users.noreply.github.com> Date: Fri, 27 Dec 2024 00:08:15 +0530 Subject: [PATCH] refactor:vitest to src/components/MemberDetail/* (#2945) --- ...st.tsx => EventsAttendedByMember.spec.tsx} | 0 ...st.tsx => EventsAttendedCardItem.spec.tsx} | 3 ++- ...tsx => EventsAttendedMemberModal.spec.tsx} | 19 ++++++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) rename src/components/MemberDetail/{EventsAttendedByMember.test.tsx => EventsAttendedByMember.spec.tsx} (100%) rename src/components/MemberDetail/{EventsAttendedCardItem.test.tsx => EventsAttendedCardItem.spec.tsx} (96%) rename src/components/MemberDetail/{EventsAttendedMemberModal.test.tsx => EventsAttendedMemberModal.spec.tsx} (91%) diff --git a/src/components/MemberDetail/EventsAttendedByMember.test.tsx b/src/components/MemberDetail/EventsAttendedByMember.spec.tsx similarity index 100% rename from src/components/MemberDetail/EventsAttendedByMember.test.tsx rename to src/components/MemberDetail/EventsAttendedByMember.spec.tsx diff --git a/src/components/MemberDetail/EventsAttendedCardItem.test.tsx b/src/components/MemberDetail/EventsAttendedCardItem.spec.tsx similarity index 96% rename from src/components/MemberDetail/EventsAttendedCardItem.test.tsx rename to src/components/MemberDetail/EventsAttendedCardItem.spec.tsx index afbb19eeea..8694426d58 100644 --- a/src/components/MemberDetail/EventsAttendedCardItem.test.tsx +++ b/src/components/MemberDetail/EventsAttendedCardItem.spec.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import { BrowserRouter } from 'react-router-dom'; import EventAttendedCard from './EventsAttendedCardItem'; +import { vi } from 'vitest'; interface InterfaceEventAttendedCardProps { type: 'Event'; @@ -33,7 +34,7 @@ describe('EventAttendedCard', () => { }; beforeEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it('renders event details correctly', () => { diff --git a/src/components/MemberDetail/EventsAttendedMemberModal.test.tsx b/src/components/MemberDetail/EventsAttendedMemberModal.spec.tsx similarity index 91% rename from src/components/MemberDetail/EventsAttendedMemberModal.test.tsx rename to src/components/MemberDetail/EventsAttendedMemberModal.spec.tsx index ebdc3fff4c..fdec64e5f0 100644 --- a/src/components/MemberDetail/EventsAttendedMemberModal.test.tsx +++ b/src/components/MemberDetail/EventsAttendedMemberModal.spec.tsx @@ -3,15 +3,24 @@ import { render, screen, fireEvent } from '@testing-library/react'; import { MockedProvider } from '@apollo/client/testing'; import { BrowserRouter } from 'react-router-dom'; import EventsAttendedMemberModal from './EventsAttendedMemberModal'; +import { vi } from 'vitest'; -jest.mock('react-i18next', () => ({ +/** + * Mock the `react-i18next` module to provide translation functionality. + */ + +vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key, i18n: { changeLanguage: () => Promise.resolve() }, }), })); -jest.mock('./customTableCell', () => ({ +/** + * Mock the `CustomTableCell` component for testing. + */ + +vi.mock('./customTableCell', () => ({ CustomTableCell: ({ eventId }: { eventId: string }) => (