-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
shallow doesn't work properly with redux connect(store) #435
Comments
I am using
Does this work for you? |
@5punk I use redux-mock-store, too 😄 |
Not sure it's correct or not, but I think it's related to our problem |
This issue is really painful as we need to use react-addons for testing in mentioned scenario when child component is connected. In my opinion Unit Test should not pass store via context - we just to test component as a atomic unit. |
closing in favor of #472 |
You can also use |
What we want to test is the actual component itself, so you need to export that and import as |
@Zzamanta yes, |
@Zzamanta thanks! It solved my problem. |
@ljharb, managed to my connected, HOC'd component to test like so:
But componentDidMount() is not triggered. Using mount does trigger componentDidMount() though. Any idea why? enzyme@3.7.0 |
Do you have |
No. It seems I didn't dive deep enough.
Notice the extra |
This was the easiest solution! However, one also needs to export the corresponding class that is being imported.
|
related to this issue reduxjs/redux#1534, #183
Not sure is this correct place to post, but i encounter a bug when using enzyme with redux
Could not find "store" in either the context or props .... Either wrap the root component in a <Provider>, or explicitly pass "store"
Here is my test
Header.js
I also created my example repo
https://github.com/MQuy/redux-store-enzyme
The text was updated successfully, but these errors were encountered: