Download react-boilerplate/app/components/ListItem/tests/index.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 677 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/components/ListItem/tests/index.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-boilerplate/app/components/ListItem/tests/index.test.js
-
curl -L -o index.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-boilerplate/app/components/ListItem/tests/index.test.js
677 Bytes
| import React from 'react'; | |
| import { render } from 'react-testing-library'; | |
| import 'jest-dom/extend-expect'; | |
| import ListItem from '../index'; | |
| describe('<ListItem />', () => { | |
| it('should have a class', () => { | |
| const { container } = render(<ListItem className="test" />); | |
| expect(container.querySelector('li').hasAttribute('class')).toBe(true); | |
| }); | |
| it('should render the content passed to it', () => { | |
| const content = <div data-testid="test">Hello world!</div>; | |
| const { getByTestId } = render(<ListItem item={content} />); | |
| expect(getByTestId('test').tagName).toEqual('DIV'); | |
| expect(getByTestId('test')).toHaveTextContent('Hello world!'); | |
| }); | |
| }); | |