Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated src/components/DynamicDropDown from Jest to Vitest #2847

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading