October 2019
Intermediate to advanced
426 pages
11h 49m
English
We are going to use the waitForNextUpdate function to test debouncing in our useDebouncedUndo Hook by following these steps:
import { renderHook, act } from '@testing-library/react-hooks'import useDebouncedUndo from './useDebouncedUndo'
test('should use debounced undo', () => { const { result } = renderHook(() => useDebouncedUndo()) const [ content, setter, undoRest ] = result.current expect(content).toBe('') expect(typeof setter).toBe('function') ...Read now
Unlock full access