import { cleanup } from '@testing-library/react'; import { render } from '../../../utils/theme-render-wrapper'; import { ASSETS_URL } from '../../../consts/common'; import { Modal } from './modal'; afterEach(cleanup); const handleClose = jest.fn(); const handleVideoBtn = jest.fn(); describe('', () => { it(`Should render successfully`, () => { const { baseElement } = render(); expect(baseElement).toBeTruthy(); }); it(`Should render with props, opened`, () => { const { queryByTestId } = render( ); const closeEl = queryByTestId('close'); closeEl?.click(); expect(handleClose).toHaveBeenCalled(); }); it(`Should render with icon and title`, () => { const { container } = render( ); const iconEl = container.getElementsByTagName('svg'); expect(iconEl).toBeTruthy(); }); it(`Should render with videoUrl and videoBtnTxt`, () => { const { queryByTestId } = render( ); const videoBtnEl = queryByTestId('videoBtn'); videoBtnEl?.click(); expect(handleClose).toHaveBeenCalled(); expect(handleVideoBtn).toHaveBeenCalled(); }); it(`Should render with dialogTitleProps, avatarProps and youtubeProps`, () => { const title = 'P81 Cybersecurity Experience Platform'; const { queryAllByTestId } = render( ); const closeEl = queryAllByTestId('close')[0]; closeEl?.click(); expect(handleClose).toHaveBeenCalled(); }); });