Skip to content

Commit

Permalink
Refactor : src/components/AgendaItems/AgendaItemsCreateModal from Jes…
Browse files Browse the repository at this point in the history
…t to Vitest #2489  (#2727)

* file name changed

* migrate jest to vitest

* changes done

* formated the code

* fixed the type error

* removed @testing-library/jest-dom

* @testing-library/jest-dom removed
  • Loading branch information
Ramneet04 authored Dec 23, 2024
1 parent 007bcb0 commit df2dd67
Showing 1 changed file with 10 additions and 8 deletions.
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

0 comments on commit df2dd67

Please sign in to comment.