import { render, screen } from '@testing-library/react'; import React from 'react'; import Modal from '../../components/common/Modal'; // jest.mock('React', () => ({ // ...jest.requireActual('React'), // useEffect: jest.fn(), // })); // const mockedUseEffect = useEffect as jest.Mock; // jest.mock('../../components/common/Icon', () => () =>
); describe('Modal Component', () => { it('Renders without crashing', async () => { render( console.log() }>
); // mockedUseEffect.mock.calls[0](); expect(document.querySelector('.modal')).toBeInTheDocument(); }); // it('Sets up the escapae key shortcut', async () => { // render( console.log() }>
); // expect(mockedUseEffect).toBeCalled(); // }); it('Displays the Given Content', async () => { render( console.log() }>

Hello Modal!!

); expect(await screen.findByText('Hello Modal!!')).toBeInTheDocument(); }); it('Renders Modal Title', async () => { render( console.log() } title="Sample Modal Title">

Some Modal Content

); expect(await screen.findByText('Sample Modal Title')).toBeInTheDocument(); }); });