-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
First - Thank you very much, you are doing amazing work!
Bug report:
What is the current behavior?
I'm using TestUtils from react-dom/test-utils
After rendering a component tree that contains a connected component, the connected component instance can't be found with TestUtils.findRenderedComponentWithType
Example -
In my component
class MyCompInner extends Component {
...
}
const MyComp = connect(mapStateToProps ...)(MyCompInner)
In the test
// someWrapper is an instance that was rendered with ReactDOM.render. It renders the connected MyComp in its render method
// method
const myCompInstance = TestUtils.findRenderedComponentWithType(someWrapper, MyComp)
// fails with Error: Did not find exactly one match (found: 0) for componentType:[object Object]
const myCompInnerInstance = TestUtils.findRenderedComponentWithType(someWrapper, MyCompInner)
// works ok
Please let me know if you need the full code example or this is enough to understand.
What is the expected behavior?
It should be possible to find the connected component instance, not just the inner component instance, as it was in previous versions.
Which versions of React, ReactDOM/React Native, Redux, and React Redux are you using? Which browser and OS are affected by this issue? Did this work in previous versions of React Redux?
The tests run in node, with jest (standard CRA project)
I've just upgraded react-redux from 5.0.7 to 7.0.2 and this started happening
I'm using version react and react-dom version 16.8.4