import React from 'react'; import { render, cleanup } from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; import { Fade } from '../index'; afterEach(cleanup); test('should take a snapshot', () => { const { asFragment } = render(); expect(asFragment()).toMatchSnapshot(); }); describe('Tests Fade with and without children', () => { test('renders a Fade without children', () => { const { getByTestId } = render(); expect(getByTestId('fade-id')).toBeInTheDocument(); }); test('renders a Fade with children', () => { const { getByTestId } = render(

Child Content

); expect(getByTestId('fade-id')).toBeInTheDocument(); expect(getByTestId('fade-id')).toContainElement(getByTestId('child-id')); }); });