N.Achyuth Reddy
Upload 683 files
9705b6c
raw
history blame contribute delete
597 Bytes
import { render, fireEvent } from '@testing-library/react';
import Stop from '../Stop';
describe('Stop', () => {
it('should render the Stop button', () => {
const { getByText } = render(
<Stop
onClick={() => {
('');
}}
/>,
);
expect(getByText('Stop')).toBeInTheDocument();
});
it('should call onClick when the button is clicked', () => {
const handleClick = jest.fn();
const { getByText } = render(<Stop onClick={handleClick} />);
fireEvent.click(getByText('Stop'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
});