Skip to Main Content
Mastering React Test-Driven Development - Second Edition
book

Mastering React Test-Driven Development - Second Edition

by Daniel Irvine
September 2022
Intermediate to advanced content levelIntermediate to advanced
564 pages
9h 56m
English
Packt Publishing
Content preview from Mastering React Test-Driven Development - Second Edition

3

Refactoring the Test Suite

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack Web Development with GraphQL and React - Second Edition

Full-Stack Web Development with GraphQL and React - Second Edition

Sebastian Grebe

Publisher Resources

ISBN: 9781803247120Supplemental Content