Download react-use/tests/useNetworkState.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-use/tests/useNetworkState.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-use/tests/useNetworkState.test.ts
-
curl -L -o useNetworkState.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-use/tests/useNetworkState.test.ts
672 Bytes
| import { renderHook } from '@testing-library/react-hooks'; | |
| import { useNetworkState } from '../src'; | |
| //ToDo: improve tests | |
| describe(`useNetworkState`, () => { | |
| it('should be defined', () => { | |
| expect(useNetworkState).toBeDefined(); | |
| }); | |
| it('should return an object of certain structure', () => { | |
| const hook = renderHook(() => useNetworkState(), { initialProps: false }); | |
| expect(typeof hook.result.current).toEqual('object'); | |
| expect(Object.keys(hook.result.current)).toEqual([ | |
| 'online', | |
| 'previous', | |
| 'since', | |
| 'downlink', | |
| 'downlinkMax', | |
| 'effectiveType', | |
| 'rtt', | |
| 'saveData', | |
| 'type', | |
| ]); | |
| }); | |
| }); | |