Chapter 14: Unit Testing

Learning Objectives

Upon completing the content in this chapter, you should be able to do the following:

  1. Write unit tests to test the behavior of functions
  2. Identify proper test cases for which a test should be written
  3. Understand the importance of testing in creating well-functioning code
  4. Use test-driven development to define the behavior of code before writing it, and to ensure that code is properly tested

Key Terminology

Here is a list of key terms for this chapter, broken down by the page they first appear on. Make note of these terms and their definitions.

Why Test Your Code?

  1. unit testing
  2. regression
  3. self-documenting code

Hello, Jest!

  1. Jest
  2. unit testing framework
  3. test suite
  4. specification
  5. spec
  6. expectation
  7. matcher

Test-Driven Development

  1. test-driven development
  2. refactoring code

Chapter Content