Test-Driven Development

Learn about test-driven development and how to write a test using the Jest framework.

Perhaps a brief explanation of that concept is in order. Test-driven development (TDD) comes from the Extreme Programming movement. Its core idea is to create a test that verifies the code’s behavior before actually writing that code. Let’s write a function that adds two numbers.

Writing test

Before writing code, we’ll create the following test using the Jest framework:

Get hands-on with 1200+ tech skills courses.