Skip to content

Instantly share code, notes, and snippets.

@jarrodmedrano
Last active August 31, 2023 21:00
Show Gist options
  • Save jarrodmedrano/6932e3bfc54f2c59a9dfd0dc9867e483 to your computer and use it in GitHub Desktop.
Save jarrodmedrano/6932e3bfc54f2c59a9dfd0dc9867e483 to your computer and use it in GitHub Desktop.
Test custom hooks
//@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