import React from 'react'; import { render, screen } from '@testing-library/react'; import { CardBody } from '../CardBody'; describe('CardBody', () => { test('renders with PatternFly Core styles', () => { const { asFragment } = render(); expect(asFragment()).toMatchSnapshot(); }); test('className is added to the root element', () => { render(); expect(screen.getByTestId('test-id')).toHaveClass('extra-class'); }); test('extra props are spread to the root element', () => { const testId = 'card-body'; render(); expect(screen.getByTestId(testId)).toBeInTheDocument(); }); test('allows passing in a string as the component', () => { const component = 'section'; render(section content); expect(screen.getByText('section content')).toBeInTheDocument(); }); test('allows passing in a React Component as the component', () => { const Component = () =>
im a div
; render(); expect(screen.getByText('im a div')).toBeInTheDocument(); }); test('body with no-fill applied', () => { const { asFragment } = render(); expect(asFragment()).toMatchSnapshot(); }); });