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('snapshot - default', () => {
   const tree = renderer.create(<CloseBtn />).toJSON();
   expect(tree).toMatchSnapshot();
});

it('snapshot - with custom size', () => {
   const tree = renderer.create(<CloseBtn size={104} />).toJSON();
   expect(tree).toMatchSnapshot();
});

it('snapshot - with custom color', () => {
   const tree = renderer.create(<CloseBtn color="red" />).toJSON();
   expect(tree).toMatchSnapshot();
});

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

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