import React from 'react';
import renderer from 'react-test-renderer';
import { render, fireEvent, screen } from '@testing-library/react';
import 'jest-styled-components';
import { PageError } from '.';

it('renderizar PageError fullscreen', () => {
   const tree = renderer.create(<PageError retry={() => {}} />).toJSON();
   expect(tree).toMatchSnapshot();
});

it('renderizar PageError sem fullscreen', () => {
   const tree = renderer.create(<PageError retry={() => {}} nonFullscreen />).toJSON();
   expect(tree).toMatchSnapshot();
});

it('testar onClick', (done) => {
   function handleClick(): void {
      done();
   }
   render(<PageError retry={handleClick} />);

   fireEvent.click(screen.getByTestId('retry-btn'));
});
