tomwayson / esri-loader-hooks

Custom React hooks for using the ArcGIS API for JavaScript with esri-loader.
https://esri-loader-hooks.netlify.com/
MIT License
28 stars 14 forks source link

Add meaningful tests #3

Open tomwayson opened 4 years ago

tomwayson commented 4 years ago

Probably should try react-hooks-testing-library.

If that doesn't work, looks like the best approach is to have the tests create a component that uses the hooks and then do a rendering test on the component with react-testing-library.

In either case will want to mock either the functions in utils/arcgis or esriLoader.loadModules itself.

tomwayson commented 4 years ago

More resources

https://blog.bitsrc.io/how-to-create-and-test-react-custom-hooks-927fe468c361 https://medium.com/@nitinpatel_20236/unit-testing-custom-react-hooks-caa86f58510