From ab4a1f181541b433f14391d97c247e530e41d56a Mon Sep 17 00:00:00 2001 From: Pratap Rathi Date: Wed, 25 Dec 2024 10:20:28 +0530 Subject: [PATCH] Refactor: Migrated src/components/DynamicDropDown/DynamicDropDown.test.tsx from Jest to Vitest --- ...DropDown.test.tsx => DynamicDropDown.spec.tsx} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename src/components/DynamicDropDown/{DynamicDropDown.test.tsx => DynamicDropDown.spec.tsx} (91%) diff --git a/src/components/DynamicDropDown/DynamicDropDown.test.tsx b/src/components/DynamicDropDown/DynamicDropDown.spec.tsx similarity index 91% rename from src/components/DynamicDropDown/DynamicDropDown.test.tsx rename to src/components/DynamicDropDown/DynamicDropDown.spec.tsx index dac98ca9e6..85c3208a20 100644 --- a/src/components/DynamicDropDown/DynamicDropDown.test.tsx +++ b/src/components/DynamicDropDown/DynamicDropDown.spec.tsx @@ -11,11 +11,12 @@ import { BrowserRouter } from 'react-router-dom'; import { I18nextProvider } from 'react-i18next'; import i18nForTest from 'utils/i18nForTest'; import userEvent from '@testing-library/user-event'; +import { vi, expect, it } from 'vitest'; describe('DynamicDropDown component', () => { - test('renders and handles selection correctly', async () => { + it('renders and handles selection correctly', async () => { const formData = { fieldName: 'value2' }; - const setFormData = jest.fn(); + const setFormData = vi.fn(); render( @@ -60,10 +61,10 @@ describe('DynamicDropDown component', () => { expect(dropdownButton).toHaveTextContent('Label 2'); }); }); - test('calls custom handleChange function when provided', async () => { + it('calls custom handleChange function when provided', async () => { const formData = { fieldName: 'value1' }; - const setFormData = jest.fn(); - const customHandleChange = jest.fn(); + const setFormData = vi.fn(); + const customHandleChange = vi.fn(); render( @@ -103,9 +104,9 @@ describe('DynamicDropDown component', () => { ); expect(setFormData).not.toHaveBeenCalled(); }); - test('handles keyboard navigation correctly', async () => { + it('handles keyboard navigation correctly', async () => { const formData = { fieldName: 'value1' }; - const setFormData = jest.fn(); + const setFormData = vi.fn(); render(