2 ms·
It got a lot better unit testing UI recently especially being able to snapshot test different scenarios. In the end if you have stateless React components testi
by andy_ppp 9y ago
It got a lot better unit testing UI recently especially being able to snapshot test different scenarios. In the end if you have stateless React components testing with jest and enzyme is easy. Again supplying state hooks for the various different interactions a more complex component might have is perfectly possible.
Additionally separate your components logic from rendering and test that; e.g. a calendar widget I just created has a load of tested functionality for creating lists of dates with various attributes (isCurrentMonth, isToday, isSelectable, isSelected, etc). This can be unit tested just fine.
Finally I’d strongly recommend cypress for doing e2e testing.