Download react-boilerplate/app/components/H2/tests/index.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 602 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/components/H2/tests/index.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-boilerplate/app/components/H2/tests/index.test.js
-
curl -L -o index.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/components/H2/tests/index.test.js
602 Bytes
| import React from 'react'; | |
| import { render } from 'react-testing-library'; | |
| import H2 from '../index'; | |
| describe('<H2 />', () => { | |
| it('should render a prop', () => { | |
| const id = 'testId'; | |
| const { container } = render(<H2 id={id} />); | |
| expect(container.querySelector('h2').id).toEqual(id); | |
| }); | |
| it('should render its text', () => { | |
| const children = 'Text'; | |
| const { container, queryByText } = render(<H2>{children}</H2>); | |
| const { childNodes } = container.querySelector('h2'); | |
| expect(childNodes).toHaveLength(1); | |
| expect(queryByText(children)).not.toBeNull(); | |
| }); | |
| }); | |