I've been using jest and have been reading through the @testing-library/react docs but so far found nothing relating to mocking state in react. I know mocking state in react is possible with enzyme. But I'm using react 18 and there is no enzyme-adapter for this version. I'm quite new to unit testing and would love to get some suggestions on this.
Asked
Active
Viewed 584 times
1
-
1_Don't_ mock state. Test components as they're used, via the public API. – jonrsharpe Jun 04 '22 at 15:06