Shift3 / standards-and-practices

Standards and Practices for Bitwise Industries
https://shift3.github.io/standards-and-practices/
63 stars 41 forks source link

[Feat]: Add link to React Hooks Testing Library #324

Closed AramayisO closed 2 years ago

AramayisO commented 2 years ago

Is your feature request related to a problem? Please describe.

Unit testing hooks is not easy as hooks can only be invoked inside function components or other hooks. As a result, you have to write a component solely for testing a custom hook and have to work out how to trigger all the various ways in which the hook can be updated.

Describe the solution you'd like.

A link to the React Hooks Testing Library docs should be added to the list of unit testing tools.

Additional context

The react-hooks-testing-library simplifies all of this by allowing you to create a simple test harness for React hooks that handles running them within the body of a function component, as well as providing various useful utility functions for updating the inputs and retrieving the outputs of your custom hooks.