With all of that background information out of the way, let's focus on writing some real tests for the application we've built. In the following sections, we will write tests for the routes, servers, models, and controllers in our application.
Let's start things a little slow by taking a look at one of the most basic files in our application, the
routes.js file. This file simply defines the number of routes that the application should respond to. This is going to be one of the easiest files to write tests for.
routes.js file is in the
server folder within our main application, let's put its corresponding test file in a similar location. Within the
tests/server folder, create a file named