ovidiuch / react-testing-examples

Searchable library of React testing examples
https://react-testing-examples.netlify.app
MIT License
387 stars 29 forks source link

Add Higher Order component test example #8

Open nilesh-jadhav opened 6 years ago

nilesh-jadhav commented 6 years ago

Thanks for the great examples, those are very helpful. Can you please add an example for HOC.

ovidiuch commented 6 years ago

Hi @nilesh-jadhav,

Sorry for neglecting this issue. In the meantime I revamped react-testing-examples.

Could you give an example of what you mean? Note that in the current tests a bunch of HOCs are tested implicitly (eg. Redux's connect or React Router's withRouter).

If you meant testing a custom HOC separately, it might not be the right fit for this project in my opinion. The current examples are testing components from the user's perspective (see philosophy of react-testing-library), so I'd consider a HOC an implementation detail in most cases.