import { render } from '@testing-library/react' import { FormState } from '../FormState' describe('', () => { it('should return nothing if the state is idle', async () => { const { container } = render() expect(container.innerHTML.length).toEqual(0) }) it('should return nothing if the message is null', async () => { const { container } = render() expect(container.innerHTML.length).toEqual(0) }) it('should render the if state is loading', async () => { const { getByTestId } = render() expect(getByTestId('loader')).toBeInTheDocument() }) it('should render the success message if state is success', async () => { const message = 'Success Message' const { getByText } = render( ) expect(getByText(message)).toBeInTheDocument() }) it('should render the error message if state is error', async () => { const { getByTestId } = render() expect(getByTestId('error')).toBeInTheDocument() }) })