To get started, we'll install SuperTest in our application by running npm install from the Terminal. We have the Node server still running. Let's shut that down and then install the module.
We can use npm i, the module name is supertest and we'll be grabbing the most recent version, @2.0.0. This is a test-specific module so we'll be installing it with save. We'll use save-dev to add it to the devDependencies in package.json:
npm i supertest@3.0.0 --save-dev

With SuperTest installed, we are now ready to work on the server.test.js file. As it doesn't yet exist inside the server folder, so we can create it. It's going to sit just alongside server.js:

Now that we have server.test.js in place, we can start setting up our very first test. First, we'll be creating a constant called request and setting that equal to the return result from requiring supertest:
const request = require('supertest');
This is the main method we'll be using to test our Express apps. From here, we can load in the Express application. Now inside server.js, we don't have an export that exports the app, so we'll have to add that. I'll add it next to the app.listen statement by creating module.exports.app and setting that equal to the app variable:
app.listen(3000);
module.exports.app = app;
Now we have an export called app that we can access from other files. The server.js is still going to run as expected when we start it from the Terminal, not in test mode. We just added an export so if anyone happens to require it, they can get access to that app. Inside server.test.js, we'll make a variable to import this. We'll call the variable app. Then we'll require using require('./server.js'), or just server. Then we'll access the .app property:
const request = require('supertest');
var app = require('./server').app;
With this in place, we now have everything we need to write our very first test.