diff --git a/src/screens/UserPortal/Volunteer/Invitations/Invitations.test.tsx b/src/screens/UserPortal/Volunteer/Invitations/Invitations.spec.tsx similarity index 96% rename from src/screens/UserPortal/Volunteer/Invitations/Invitations.test.tsx rename to src/screens/UserPortal/Volunteer/Invitations/Invitations.spec.tsx index 2c0cafc6a9..867f95c1aa 100644 --- a/src/screens/UserPortal/Volunteer/Invitations/Invitations.test.tsx +++ b/src/screens/UserPortal/Volunteer/Invitations/Invitations.spec.tsx @@ -21,14 +21,24 @@ import { } from './Invitations.mocks'; import { toast } from 'react-toastify'; import useLocalStorage from 'utils/useLocalstorage'; +import { vi, expect } from 'vitest'; -jest.mock('react-toastify', () => ({ +vi.mock('react-toastify', () => ({ toast: { - success: jest.fn(), - error: jest.fn(), + success: vi.fn(), + error: vi.fn(), }, })); +vi.mock('react-router-dom', async () => { + const actual = await vi.importActual('react-router-dom'); + return { + ...actual, + useParams: () => ({ orgId: 'orgId' }), + useNavigate: vi.fn(), + }; +}); + const { setItem } = useLocalStorage(); const link1 = new StaticMockLink(MOCKS); @@ -79,19 +89,12 @@ const renderInvitations = (link: ApolloLink): RenderResult => { }; describe('Testing Invvitations Screen', () => { - beforeAll(() => { - jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useParams: () => ({ orgId: 'orgId' }), - })); - }); - beforeEach(() => { setItem('userId', 'userId'); }); afterAll(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it('should redirect to fallback URL if URL params are undefined', async () => {