New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Proxyquire to stub sub-components in unit tests results in test failure. #268
Comments
The associated template:
|
Added a link to a repo with a contrived test case within a working sample application. |
I don't understand how proxyquire works so maybe this won't help you but I found that commenting out stub['@global'] = true; in this method: this.stubComponent = function(className) {
// mock react component
var stub = React.createClass({
render() {
return <div className={className || 'stub'}/>;
}
});
//stub['@global'] = true; // this might not be needed in your case, refer to proxyquire docs
return stub;
}; in As I said, I didn't understand what it did, or why it helped, so maybe that's not what you wanted. |
Thanks Dan, that doesn't completely solve my issue but it points me in the right direction. I'll update this issue once it's resolved, in case anyone else runs across it. |
Issue resolved using: |
Warning: Failed Context Types: Required context
dragDropManager
was not specified inDragSource(ProductComponent)
.see https://github.com/cmelion/react-hot-boilerplate/tree/Invariant-Violation-DND
Error: Invariant Violation: Could not find the drag and drop manager in the context of ProductComponent. Make sure to wrap the top-level component of your app with DragDropContext. Read more: http://gaearon.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context
When subcomponents are commented out, the test runs as expected.
The text was updated successfully, but these errors were encountered: