October 2019
Intermediate to advanced
426 pages
11h 49m
English
Now that we have defined the StateContextWrapper, we can use it to test the useDispatch Hook.
Let's test the useDispatch Hook with the following steps:
import { renderHook } from '@testing-library/react-hooks'import { StateContextWrapper } from './testUtils'import useDispatch from './useDispatch'
test('should use dispatch', () => { const { result } = renderHook( () => useDispatch(), { wrapper: StateContextWrapper } )
Read now
Unlock full access