December 2016
Intermediate to advanced
136 pages
2h 58m
English
© Caio Ribeiro Pereira 2016
Caio Ribeiro Pereira, Building APIs with Node.js , 10.1007/978-1-4842-2442-7_8
Caio Ribeiro Pereira1
(1)São Vicente - SP, São Paulo, Brazil
Creating automated tests is highly recommended. There are several types of tests: unitary, functional, acceptance, and others. This chapter focuses only on the acceptance test, which in our case aims to test the outputs and behaviors of our API’s routes.
To create and execute the tests, it’s necessary to use a test runner. We’ll use Mocha (Figure 8-1), which is very popular in the Node.js community.

Mocha has the following ...