import React from 'react'; import { fireEvent, render } from '@testing-library/react'; import InputText from './InputText'; describe('', () => { it('renders the component with the required props', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('renders the component with focus', () => { const { container } = render(); fireEvent.focus(container); expect(container.firstChild).toMatchSnapshot(); }); it('renders the component with isValid set as true', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('renders the component with error', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('renders the component disabled', () => { const { container } = render(); expect(container.firstChild).toMatchSnapshot(); }); it('renders the component with an icon on the left', () => { const { container, queryByTestId } = render( } />, ); expect(queryByTestId('start-icon')).toBeTruthy(); expect(container.firstChild).toMatchSnapshot(); }); it('renders the component with an icon on the right', () => { const { container, queryByTestId } = render( } />, ); expect(queryByTestId('end-icon')).toBeTruthy(); expect(container.firstChild).toMatchSnapshot(); }); });