import React from 'react'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { BaseModal } from '../../components/base/BaseModal'; describe('BaseModal', () => { const defaultProps = { isOpen: true, onClose: jest.fn(), title: 'Test Modal', children:
Modal Content
, }; it('should render modal when open', () => { render(); expect(screen.getByText('Test Modal')).toBeInTheDocument(); expect(screen.getByText('Modal Content')).toBeInTheDocument(); }); it('should not render modal when closed', () => { render(); expect(screen.queryByText('Test Modal')).not.toBeInTheDocument(); expect(screen.queryByText('Modal Content')).not.toBeInTheDocument(); }); it('should render with custom maxWidth and maxHeight', () => { render( ); const modalContent = screen.getByTestId('modal-content'); expect(modalContent).toHaveClass('sm:max-w-[800px]'); expect(modalContent).toHaveClass('max-h-[80vh]'); }); it('should render with description when provided', () => { render( ); expect(screen.getByText('Test description')).toBeInTheDocument(); }); it('should render footer when provided', () => { const footer = ; render(); expect(screen.getByText('Save')).toBeInTheDocument(); }); });