Author Archives: paradite

Two Point Hospital Tips For GP’s Office Queue Problem

With more than 40 hours into Two Point Hospital Game, I have managed to progress to 27 stars and overcome some of the common problems that new players complained on the forum. If you are struggling with long GP’s Office queue, overcrowding, etc, check out these Two Point Hospital Tips For GP’s Office: Continue reading

Guide on How to Test React Apollo components with Enzyme

Testing React Apollo components with Enzyme

Update on 12 Sept 2018:

React Apollo introduced official documentation on testing in June 2018:

https://www.apollographql.com/docs/guides/testing-react-components.html

You can still read my original post below, which includes Enzyme specific techniques that is not covered in official docs.


Despite its popularity, React Apollo client has no good documentations on how to do testing for React Apollo components with Enzyme.

The only documentation that I found online for testing React Apollo component is a comment from React Apollo team on GitHub, and it is not using Enzyme.

So how do you test React Apollo components with Enzyme? And perhaps more importantly how do you get access to the inner component wrapped by React Apollo as a higher-order component (HOC) to mock its functions and verify its behaviours? Continue reading