Skip to content

Commit

Permalink
Update Agenda items vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
mandeepnh5 committed Dec 24, 2024
1 parent aff65c9 commit b732908
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';

import AgendaItemsPreviewModal from './AgendaItemsPreviewModal';
import { describe, test, expect, vi } from 'vitest';

const mockFormState = {
title: 'Test Title',
Expand Down Expand Up @@ -44,10 +45,10 @@ describe('AgendaItemsPreviewModal', () => {
<LocalizationProvider dateAdapter={AdapterDayjs}>
<AgendaItemsPreviewModal
agendaItemPreviewModalIsOpen
hidePreviewModal={jest.fn()}
hidePreviewModal={vi.fn()}
formState={mockFormState}
showUpdateModal={jest.fn()}
toggleDeleteModal={jest.fn()}
showUpdateModal={vi.fn()}
toggleDeleteModal={vi.fn()}
t={mockT}
/>
</LocalizationProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import { store } from 'state/store';
import i18nForTest from 'utils/i18nForTest';

import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';

import AgendaItemsUpdateModal from './AgendaItemsUpdateModal';
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 Down Expand Up @@ -67,19 +68,19 @@ const mockAgendaItemCategories = [
},
];

const mockHideUpdateModal = jest.fn();
const mockSetFormState = jest.fn();
const mockUpdateAgendaItemHandler = jest.fn();
const mockHideUpdateModal = vi.fn();
const mockSetFormState = vi.fn();
const mockUpdateAgendaItemHandler = vi.fn();
const mockT = (key: string): string => key;

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 b732908

Please sign in to comment.