Dùng @testing-library/react với renderHook utility: const { result } = renderHook(() => useMyHook()); expect(result.current.value).toBe(expected).
- Để test interactions:
act(() => { result.current.setValue('new') }). - Với async hooks dùng
waitFor.renderHooktạo component test wrapper để hooks có React context đầy đủ.