O'Reilly logo

Hands-On Full Stack Web Development with Aurelia by Erikson Haziz Murrugarra Sifuentes, Diego Jose Arguelles Rojas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making our code fail

It is important to know that we won't use any testing framework at this point. The main goal in this section is to understand how TDD works; we have a complete tour of testing technology in the following sections in this chapter.

We will use TDD to create an additional function called sum, which will return the sum of two numbers that are passed as parameters. First, using an editor of your choice, create a new file called testing.js and add the following code:

const assert = require('assert');function add(n1, n2) {  return 0;}

First, we import the assert module to use its equal function. The equal function expects three parameters:

  • The current value or expression to be analyzed
  • The expected value
  • The message that should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required