import { fireEvent } from '@testing-library/react';
import { simpleRender } from '../../.jest/test-utils';
import { Button } from './Button';
describe('Button', () => {
it('renders correctly', () => {
expect(() => simpleRender()).not.toThrow();
});
it('calls onClick when clicked', () => {
const fn = jest.fn();
const { getByText } = simpleRender();
const button = getByText('Button');
fireEvent.click(button);
expect(fn).toHaveBeenCalledTimes(1);
});
it('shows a spinner when loading', () => {
const { getByTestId } = simpleRender();
expect(() => getByTestId('spinner')).not.toThrow();
});
});