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