Last active
August 31, 2023 21:00
-
-
Save jarrodmedrano/6932e3bfc54f2c59a9dfd0dc9867e483 to your computer and use it in GitHub Desktop.
Test custom hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@testing-library/react-hooks package will help to test hooks functionalities. | |
const { result, waitForNextUpdate } = renderHook(() => useCustomHooks()); | |
act(() => { | |
result.current[0]('123'); | |
}); | |
await waitForNextUpdate(); | |
expect(result.current[1].isSuccess).toBe(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment