import { render, fireEvent } from '@testing-library/react'; import Stop from '../Stop'; describe('Stop', () => { it('should render the Stop button', () => { const { getByText } = render( { (''); }} />, ); expect(getByText('Stop')).toBeInTheDocument(); }); it('should call onClick when the button is clicked', () => { const handleClick = jest.fn(); const { getByText } = render(); fireEvent.click(getByText('Stop')); expect(handleClick).toHaveBeenCalledTimes(1); }); });