How to do it...

What components should we test? We have worked with connected and unconnected components already, but we'll focus on the latter here. Why? Connected components get their props and dispatch logic from the mapStateToProps() and mapDispatchToProps() functions; we can trust this is so, and therefore we don't actually have to test it. If you want, you could set up a store and verify that those two functions do their job—but those test are trivial to write, and I wouldn't suggest that you actually need them. Instead, we'll focus on the unconnected version of the components and fully test them. We'll set up all of the tests here, and then we'll look at how to run them, and what output to expect.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.163.13