import { render, screen } from '@testing-library/react'; import { CodeBlock } from '../CodeBlock'; import styles from '@patternfly/react-styles/css/components/CodeBlock/code-block'; test('CodeBlock renders', () => { render(test text); expect(screen.getByText('test text')).toBeVisible(); }); test(`CodeBlock content renders with class ${styles.codeBlockContent} by default`, () => { render(Test); expect(screen.getByText('Test')).toHaveClass(styles.codeBlockContent); }); test('CodeBlock renders with custom class', () => { render( Test ); expect(screen.getByTestId('code-block')).toHaveClass('tester'); }); test('Renders when actions are passed to CodeBlock', () => { render(actions} />); expect(screen.getByText('actions')).toBeVisible(); }); test('Matches the snapshot', () => { const { asFragment } = render(actions}>children); expect(asFragment()).toMatchSnapshot(); });