Download react-boilerplate/app/components/LoadingIndicator/tests/Wrapper.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 960 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-boilerplate/app/components/LoadingIndicator/tests/Wrapper.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-boilerplate/app/components/LoadingIndicator/tests/Wrapper.test.js
-
curl -L -o Wrapper.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-boilerplate/app/components/LoadingIndicator/tests/Wrapper.test.js
960 Bytes
| import React from 'react'; | |
| import { render } from 'react-testing-library'; | |
| import Wrapper from '../Wrapper'; | |
| describe('<Wrapper />', () => { | |
| it('should render an <div> tag', () => { | |
| const { container } = render(<Wrapper />); | |
| expect(container.firstElementChild.tagName).toEqual('DIV'); | |
| }); | |
| it('should have a class attribute', () => { | |
| const { container } = render(<Wrapper />); | |
| const element = container.firstElementChild; | |
| expect(element.hasAttribute('class')).toBe(true); | |
| }); | |
| it('should adopt a valid attribute', () => { | |
| const id = 'test'; | |
| const { container } = render(<Wrapper id={id} />); | |
| const element = container.firstElementChild; | |
| expect(element.id).toEqual(id); | |
| }); | |
| it('should not adopt an invalid attribute', () => { | |
| const { container } = render(<Wrapper attribute="test" />); | |
| const element = container.firstElementChild; | |
| expect(element.hasAttribute('attribute')).toBe(false); | |
| }); | |
| }); | |