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/EventRegistrantsModal/* from Jest to Vitest. #2910

Merged
Show file tree
Hide file tree
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,23 +11,27 @@ import { Provider } from 'react-redux';
import { I18nextProvider } from 'react-i18next';
import { store } from 'state/store';
import i18nForTest from '../../utils/i18nForTest';
import { describe, expect, vi } from 'vitest';

jest.mock('react-toastify', () => ({
vi.mock('react-toastify', () => ({
toast: {
success: jest.fn(),
error: jest.fn(),
success: vi.fn(),
error: vi.fn(),
},
}));

const mockProps = {
show: true,
handleClose: jest.fn(),
reloadMembers: jest.fn(),
handleClose: vi.fn(),
reloadMembers: vi.fn(),
};
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useParams: () => ({ eventId: '123', orgId: '123' }),
}));
vi.mock('react-router-dom', async () => {
const actual = await vi.importActual('react-router-dom');
return {
...actual,
useParams: () => ({ eventId: '123', orgId: '123' }),
};
});

const MOCKS = [
{
Expand Down Expand Up @@ -80,7 +84,7 @@ const renderAddOnSpotAttendee = (): RenderResult => {

describe('AddOnSpotAttendee Component', () => {
beforeEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});

it('renders the component with all form fields', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import i18nForTest from 'utils/i18nForTest';
import { ToastContainer } from 'react-toastify';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { describe, test, expect, vi } from 'vitest';

const queryMockWithoutRegistrant = [
{
Expand Down Expand Up @@ -160,7 +161,7 @@ describe('Testing Event Registrants Modal', () => {
show: true,
eventId: 'event123',
orgId: 'org123',
handleClose: jest.fn(),
handleClose: vi.fn(),
};

test('The modal should be rendered, correct text must be displayed when there are no attendees and add attendee mutation must function properly', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import i18nForTest from 'utils/i18nForTest';
import { ToastContainer } from 'react-toastify';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { describe, test, expect } from 'vitest';

const queryMock = [
{
Expand Down
Loading