I am someone who takes unit testing very seriously. I believe it has huge positives and is a discipline which should be followed. However I have recently come across a common belief which is the following:

“UI itself is trivial and expensive to test so it’s not worth the effort. All the actual logic is in separate utility modules, which are tested” — I personally firmly do not agree with this and here is why.

1. Business Logic

Imagine the following scenario..Function X inside an external module is responsible for a lot of logic, which is unit tested. React component Y calls Function X inside a condition and if true renders component A or if false renders nothing.

Now, the decision to render nothing instead of a broken component A is probably something the business deems as important aka Business Logic. Business Logic is most definitely something that should be covered in unit tests, the last thing anybody wants is the website to show a broken component.