Skip to content

Commit

Permalink
Refactor: Migrated src/components/DynamicDropDown/DynamicDropDown.tes…
Browse files Browse the repository at this point in the history
…t.tsx from Jest to Vitest (#2847)
  • Loading branch information
PratapRathi authored Dec 25, 2024
1 parent ce358e5 commit f60d17d
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<BrowserRouter>
Expand Down Expand Up @@ -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(
<BrowserRouter>
Expand Down Expand Up @@ -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(
<BrowserRouter>
Expand Down

0 comments on commit f60d17d

Please sign in to comment.