-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathuseNetworkState.test.ts
More file actions
26 lines (23 loc) · 768 Bytes
/
useNetworkState.test.ts
File metadata and controls
26 lines (23 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { renderHook } from '@testing-library/react-hooks';
import { useNetworkState } from '../src';
// TODO: Add comprehensive tests for network state changes, offline/online events, and network information properties
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',
]);
});
});