Grokking Node.js
Vote

0% completed

​

Introduction to Testing in Node.js

How do you know that a function still returns the right answer after someone changes it next month? You could run the program and read the output again, but nobody repeats that check for every function after every change. A test is a small piece of code that calls your code with known input and compares the result with the answer you expect. Because a test is code, a single command can run hundreds of them in a few seconds.

The running example is the cart from the debugging lesson. The bug there was a price stored as the string "12", which made cartTotal() return "31225" instead of `40

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content