Unit-Testing Setup
As far as I know you, you have strong opinions ;) so i want to be clear how we should unit test be setting up a structure. My opinion so far: Unit-testing is super helpfull the more we are at a framework level and becomes more of a burden the nearer we come to a UI level (due to the frequent changes to the UI). what definetly should be tested are complex functions like the page-option calculation. but what defines a function to be test-worthy or not? so my suggestion is to test only on a hook level: every hook (no matter how complex or not) should be tested in a way that documents it's functionality. this includes all hooks in the utils files (next to the components) and all hooks in the hooks folder.
- goal should be to document the functionality of all hooks.
- the search helper will be tested indirectly by testing the hooks
- I will spy on the search-helper "buildSearchUrl" function (when I interact with the hook i will make assumptions about the call to this fn)
- the real fetch will be mocked