September 2017
Intermediate to advanced
450 pages
11h 24m
English
Let's explore how to add some API integration tests to our Express web server's REST API. In order to work with our API, we'll need to install a Chai plugin called chai-http, which will work as a lightweight request library to make HTTP request assertions in our tests:
npm install chai-http @types/chai-http --save-dev
Another detail we need to address is that the /src/routes/Angular.ts module of our application relies on our Angular source files being inside the /dist directory. We can circumvent this by simply making this route optionally provided via an environment variable:
...const angularBuildPath = process.env.angularBuildPath ? process.env.angularBuildPath : path.resolve(__dirname, 'angular');class AngularRoute { public ...
Read now
Unlock full access