From 7bc28fc85d3cd3905ced5fcc1f497ed0181bd43d Mon Sep 17 00:00:00 2001 From: MANDEEP N H <146331633+mandeepnh5@users.noreply.github.com> Date: Wed, 25 Dec 2024 06:00:15 +0000 Subject: [PATCH] Update jest to vitest --- ...tainer.test.tsx => AgendaItemsContainer.spec.tsx} | 12 +++++------- .../AgendaItems/AgendaItemsContainerProps.ts | 5 +++-- 2 files changed, 8 insertions(+), 9 deletions(-) rename src/components/AgendaItems/{AgendaItemsContainer.test.tsx => AgendaItemsContainer.spec.tsx} (98%) diff --git a/src/components/AgendaItems/AgendaItemsContainer.test.tsx b/src/components/AgendaItems/AgendaItemsContainer.spec.tsx similarity index 98% rename from src/components/AgendaItems/AgendaItemsContainer.test.tsx rename to src/components/AgendaItems/AgendaItemsContainer.spec.tsx index 8b391a2073..f8f6ab948d 100644 --- a/src/components/AgendaItems/AgendaItemsContainer.test.tsx +++ b/src/components/AgendaItems/AgendaItemsContainer.spec.tsx @@ -7,9 +7,7 @@ import { fireEvent, } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import 'jest-localstorage-mock'; import { MockedProvider } from '@apollo/client/testing'; -import 'jest-location-mock'; import { I18nextProvider } from 'react-i18next'; import { Provider } from 'react-redux'; import { BrowserRouter } from 'react-router-dom'; @@ -24,20 +22,20 @@ import { StaticMockLink } from 'utils/StaticMockLink'; import { props, props2 } from './AgendaItemsContainerProps'; import { MOCKS, MOCKS_ERROR } from './AgendaItemsContainerMocks'; import AgendaItemsContainer from './AgendaItemsContainer'; - +import { describe, test, expect, vi } from 'vitest'; const link = new StaticMockLink(MOCKS, true); const link2 = new StaticMockLink(MOCKS_ERROR, true); -jest.mock('react-toastify', () => ({ +vi.mock('react-toastify', () => ({ toast: { - success: jest.fn(), - error: jest.fn(), + success: vi.fn(), + error: vi.fn(), }, })); //temporarily fixes react-beautiful-dnd droppable method's depreciation error //needs to be fixed in React 19 -jest.spyOn(console, 'error').mockImplementation((message) => { +vi.spyOn(console, 'error').mockImplementation((message) => { if (message.includes('Support for defaultProps will be removed')) { return; } diff --git a/src/components/AgendaItems/AgendaItemsContainerProps.ts b/src/components/AgendaItems/AgendaItemsContainerProps.ts index d6dcf3feca..f19d5ff9df 100644 --- a/src/components/AgendaItems/AgendaItemsContainerProps.ts +++ b/src/components/AgendaItems/AgendaItemsContainerProps.ts @@ -1,4 +1,5 @@ type AgendaItemConnectionType = 'Event'; +import { vi } from 'vitest'; export const props = { agendaItemConnection: 'Event' as AgendaItemConnectionType, @@ -68,7 +69,7 @@ export const props = { }, }, ], - agendaItemRefetch: jest.fn(), + agendaItemRefetch: vi.fn(), agendaItemCategories: [ { _id: 'agendaCategory1', @@ -96,6 +97,6 @@ export const props = { export const props2 = { agendaItemConnection: 'Event' as AgendaItemConnectionType, agendaItemData: [], - agendaItemRefetch: jest.fn(), + agendaItemRefetch: vi.fn(), agendaItemCategories: [], };