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

Refactor : src/components/AgendaItems/AgendaItemsCreateModal from Jest to Vitest #2489 #2727

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import AgendaItemsCreateModal from './AgendaItemsCreateModal';
import { toast } from 'react-toastify';
import convertToBase64 from 'utils/convertToBase64';
import type { MockedFunction } from 'vitest';
import { describe, test, expect, vi } from 'vitest';

const mockFormState = {
title: 'Test Title',
Expand All @@ -28,9 +30,9 @@ const mockFormState = {
urls: ['https://example.com'],
agendaItemCategoryIds: ['category'],
};
const mockHideCreateModal = jest.fn();
const mockSetFormState = jest.fn();
const mockCreateAgendaItemHandler = jest.fn();
const mockHideCreateModal = vi.fn();
const mockSetFormState = vi.fn();
const mockCreateAgendaItemHandler = vi.fn();
const mockT = (key: string): string => key;
const mockAgendaItemCategories = [
{
Expand Down Expand Up @@ -64,14 +66,14 @@ const mockAgendaItemCategories = [
},
},
];
jest.mock('react-toastify', () => ({
vi.mock('react-toastify', () => ({
toast: {
success: jest.fn(),
error: jest.fn(),
success: vi.fn(),
error: vi.fn(),
},
}));
jest.mock('utils/convertToBase64');
const mockedConvertToBase64 = convertToBase64 as jest.MockedFunction<
vi.mock('utils/convertToBase64');
const mockedConvertToBase64 = convertToBase64 as MockedFunction<
typeof convertToBase64
>;

Expand Down
Loading