Eric Elliott

Instead of mocking for UI components, I separate components into display components and container components.

The containers manage state and side-effects --I don’t unit test those at all. Instead, I use functional tests.

I keep state transitions in pure reducer functions. Easy to test in isolation from the container.

The display components are just pure functions of their props. Easy to unit test with no mocks.

The result is great unit coverage + great integration coverage because of the functional tests, and NO MOCKS. ☺

Eric Elliott

Written by

Make some magic. #JavaScript

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade