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

it('renderizar CloseBtn padrão', () => {
   const tree = renderer.create(<CloseBtn />).toJSON();
   expect(tree).toMatchSnapshot();
});

it('renderizar CloseBtn com tamanho diferente', () => {
   const tree = renderer.create(<CloseBtn size={104} />).toJSON();
   expect(tree).toMatchSnapshot();
});

it('renderizar CloseBtn com color diferente', () => {
   const tree = renderer.create(<CloseBtn color="red" />).toJSON();
   expect(tree).toMatchSnapshot();
});

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

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