Skip to content

Commit a03423d

Browse files
committed
Update EventRegistryModal jest to vitest
1 parent 35cce16 commit a03423d

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/components/EventRegistrantsModal/AddOnSpotAttendee.test.tsx renamed to src/components/EventRegistrantsModal/AddOnSpotAttendee.spec.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,27 @@ import { Provider } from 'react-redux';
1111
import { I18nextProvider } from 'react-i18next';
1212
import { store } from 'state/store';
1313
import i18nForTest from '../../utils/i18nForTest';
14+
import { describe, expect, vi } from 'vitest';
1415

15-
jest.mock('react-toastify', () => ({
16+
vi.mock('react-toastify', () => ({
1617
toast: {
17-
success: jest.fn(),
18-
error: jest.fn(),
18+
success: vi.fn(),
19+
error: vi.fn(),
1920
},
2021
}));
2122

2223
const mockProps = {
2324
show: true,
24-
handleClose: jest.fn(),
25-
reloadMembers: jest.fn(),
25+
handleClose: vi.fn(),
26+
reloadMembers: vi.fn(),
2627
};
27-
jest.mock('react-router-dom', () => ({
28-
...jest.requireActual('react-router-dom'),
29-
useParams: () => ({ eventId: '123', orgId: '123' }),
30-
}));
28+
vi.mock('react-router-dom', async () => {
29+
const actual = await vi.importActual('react-router-dom');
30+
return {
31+
...actual,
32+
useParams: () => ({ eventId: '123', orgId: '123' }),
33+
};
34+
});
3135

3236
const MOCKS = [
3337
{
@@ -80,7 +84,7 @@ const renderAddOnSpotAttendee = (): RenderResult => {
8084

8185
describe('AddOnSpotAttendee Component', () => {
8286
beforeEach(() => {
83-
jest.clearAllMocks();
87+
vi.clearAllMocks();
8488
});
8589

8690
it('renders the component with all form fields', async () => {

src/components/EventRegistrantsModal/EventRegistrantsModal.test.tsx renamed to src/components/EventRegistrantsModal/EventRegistrantsModal.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import i18nForTest from 'utils/i18nForTest';
1515
import { ToastContainer } from 'react-toastify';
1616
import { LocalizationProvider } from '@mui/x-date-pickers';
1717
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
18+
import { describe, test, expect, vi } from 'vitest';
1819

1920
const queryMockWithoutRegistrant = [
2021
{
@@ -160,7 +161,7 @@ describe('Testing Event Registrants Modal', () => {
160161
show: true,
161162
eventId: 'event123',
162163
orgId: 'org123',
163-
handleClose: jest.fn(),
164+
handleClose: vi.fn(),
164165
};
165166

166167
test('The modal should be rendered, correct text must be displayed when there are no attendees and add attendee mutation must function properly', async () => {

src/components/EventRegistrantsModal/EventRegistrantsWrapper.test.tsx renamed to src/components/EventRegistrantsModal/EventRegistrantsWrapper.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import i18nForTest from 'utils/i18nForTest';
1111
import { ToastContainer } from 'react-toastify';
1212
import { LocalizationProvider } from '@mui/x-date-pickers';
1313
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
14+
import { describe, test, expect } from 'vitest';
1415

1516
const queryMock = [
1617
{

0 commit comments

Comments
 (0)