Mantra

Understand the mantra of testing react with Enzyme.

We'll cover the following

Mantra: Test one piece at a time

There are two schools of thought on unit testing. One is that the tests should be as realistic as possible. In this view, tests against one component should depend on the behavior not only of that one component, but also of its dependencies. The other school of thought, the one applied in this course, is that tests should describe their target behavior in isolation, not the behavior within a complete system. To test the complete system, you must test each part on its own. This requires diligence and thoroughness, but the reward is that changes to a single component can only fail that component’s tests, rather than a perplexing cascade of failures. That’s why this chapter’s mantra is: “Test one piece at a time.”

Get hands-on with 1200+ tech skills courses.