diff --git a/src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.test.tsx b/src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.spec.tsx similarity index 90% rename from src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.test.tsx rename to src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.spec.tsx index 19d2249a43..4119800dd1 100644 --- a/src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.test.tsx +++ b/src/components/EditCustomFieldDropDown/EditCustomFieldDropDown.spec.tsx @@ -8,6 +8,7 @@ import availableFieldTypes from 'utils/fieldTypes'; import { I18nextProvider } from 'react-i18next'; import i18nForTest from 'utils/i18nForTest'; import type { InterfaceCustomFieldData } from 'utils/interfaces'; +import { describe, it, expect } from 'vitest'; async function wait(ms = 100): Promise { await act(() => { @@ -18,7 +19,7 @@ async function wait(ms = 100): Promise { } describe('Testing Custom Field Dropdown', () => { - test('Component Should be rendered properly', async () => { + it('Component Should be rendered properly', async () => { const customFieldData = { type: 'Number', name: 'Age', @@ -26,11 +27,10 @@ describe('Testing Custom Field Dropdown', () => { const setCustomFieldData: Dispatch< SetStateAction - > = (val) => { - { - val; - } + > = () => { + // Intentionally left blank for testing purposes }; + const props = { customFieldData: customFieldData as InterfaceCustomFieldData, setCustomFieldData: setCustomFieldData, diff --git a/src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx b/src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx index 92404f767b..6fd27ce429 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx +++ b/src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx @@ -147,7 +147,7 @@ describe('Testing Organization Dashboard Screen', () => { vi.mocked(useParams).mockReturnValue({ orgId: 'orgId' }); renderOrganizationDashboard(link1); - // Wait for initial load + // First wait for the dashboard to fully load await waitFor(() => { expect(screen.getByText(t.upcomingEvents)).toBeInTheDocument(); }); @@ -160,12 +160,8 @@ describe('Testing Organization Dashboard Screen', () => { expect(screen.getByText(t.events)).toBeInTheDocument(); expect(screen.getByText(t.blockedUsers)).toBeInTheDocument(); - // Upcoming events - Using more flexible matcher - await waitFor(() => { - expect( - screen.getByText(/Event 1/i, { exact: false }), - ).toBeInTheDocument(); - }); + // Upcoming events - Use a more flexible matcher + expect(screen.getByText(/Event 1/i, { exact: false })).toBeInTheDocument(); // Latest posts expect(screen.getByText(t.latestPosts)).toBeInTheDocument(); diff --git a/src/utils/errorHandler.test.tsx b/src/utils/errorHandler.spec.tsx similarity index 96% rename from src/utils/errorHandler.test.tsx rename to src/utils/errorHandler.spec.tsx index f229e8d5fa..96c35e2a7f 100644 --- a/src/utils/errorHandler.test.tsx +++ b/src/utils/errorHandler.spec.tsx @@ -2,10 +2,11 @@ type TFunction = (key: string, options?: Record) => string; import { errorHandler } from './errorHandler'; import { toast } from 'react-toastify'; +import { describe, it, expect, vi } from 'vitest'; -jest.mock('react-toastify', () => ({ +vi.mock('react-toastify', () => ({ toast: { - error: jest.fn(), + error: vi.fn(), }, })); @@ -22,7 +23,7 @@ describe('Test if errorHandler is working properly', () => { }; beforeEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); }); it('should call toast.error with the correct message if error message is "Failed to fetch"', async () => {