1import { renderHook, act } from '@testing-library/react-hooks'
2import useCounter from './useCounter'
3
4test('should reset counter to updated initial value', () => {
5 let initialValue = 0
6 const { result, rerender } = renderHook(() => useCounter(initialValue))
7
8 initialValue = 10
9 rerender()
10
11 act(() => {
12 result.current.reset()
13 })
14
15 expect(result.current.count).toBe(10)
16})