September 2022
Intermediate to advanced
564 pages
9h 56m
English
At this point, you’ve written a handful of tests. Although they may seem simple enough already, they can be simpler.
It’s extremely important to build a maintainable test suite: one that is quick and painless to build and adapt. One way to roughly gauge maintainability is to look at the number of lines of code in each test. To give some comparison to what you’ve seen so far, in the Ruby language, a test with more than three lines is considered a long test!
This chapter will take a look at some of the ways you can make your test suite more concise. We’ll do that by extracting common code into a module that can be reused across all your test suites. We’ll also create a custom Jest matcher.
When is the right time to ...