how to provide initialstate in test #93
Comments
Hm, are you exporting the HomeView component as a dumb component? If you're wanting to test how it renders with certain props you don't want to test the connected component, which is currently the only export: https://github.com/davezuko/react-redux-starter-kit/blob/example/todo-application/client/views/home.jsx Edit: I guess I maybe misread your question, since you're talking about initial application state it seems, though I'm not sure how that influences the unit tests for HomeView. If what I mentioned above didn't help, could you clarify? Thanks! |
I rebased the branch and made all the modifications so the todo example works again, you can find it in my fork at: https://github.com/agdolla/react-redux-starter-kit/tree/example/todo-application
When running the tests this line fails because this.props.todos is undefined. I tried to pass todos as you can see in HomeView.spec.js:
If you try to run the tests you'll see two lines of console output, one with this.props.todos defined and one with undefined :( |
Yeah I'll definitely take a look at this, though it might not be until later today. Thanks for this though, I appreciate all the work you're doing! |
Hey @agdolla, I tested out your branch and it looks like you just need to pass it in to the
Does that help at all? |
🐵 sure, I should've read the next line :) |
Hi
I try to update the example/todo-application to the current master and it works but I can not find out, how to modify the test.
In beforeEach when component is created with shallowRenderWithProps I try to pass the initialstate but it fails. The strange thing is that HomeView component is initialized with my props but the render method called for the second time with no props so it fails.
Any idea ?
The text was updated successfully, but these errors were encountered: