import { h } from 'preact'; import { render } from '@testing-library/preact'; import { axe } from 'jest-axe'; import NextPageButton from '../components/NextPageButton'; describe('', () => { const defaultProps = { onClick: () => { return 'onClick'; }, }; it('should have no a11y violations', async () => { const { container } = render(); const results = await axe(container); expect(results).toHaveNoViolations(); }); it('should show a button', () => { const { queryByText } = render(); expect(queryByText(/load more/i)).toBeDefined(); }); it('should call the onclick handler', () => { const onClick = jest.fn(); const { getByText } = render(); const button = getByText(/load more/i); button.click(); expect(onClick).toHaveBeenCalledTimes(1); }); });