React components that use context are painful to unit test
<p>React doesn't provide an API that lets you pass in context to a created component class, so you have to write a wrapper component that provides the context.</p>

<p>Unfortunately, once you do this, you no longer have direct access to the component you are trying to test - unlike <code>TestUtils.renderIntoDocument</code>, functions like <code>TestUtils.findRenderedComponentWithType</code> don't return the actual rendered component instance, they only return the component constructor. Thus you can't call methods on the component, or set the component state to some known value before executing the test. The only thing you really have access to is the DOM node for your component, which is fine if all you want to do is black box testing, but for some kinds of components that's not sufficient.</p>

<p>I'm curious to know if anyone has come up with a solution for this. I've tried about a dozen different approaches, none of which work. (For example, I tried using 'ref' in my wrapper component, but it has the same problem - doesn't give you access to the real object.)</p>