Unit testing a Node Js web app route.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.md
server.js

README.md

TestingNodeJSRoute

Testing a Node Js express web app route.

Pre-requisites - Node Js - https://nodejs.org, Mocha - npm install mocha --save-dev, supertest - npm install supertest --save-dev, assert - npm install assert --save-dev, expressjs - npm install express --save-dev

Since Node JS does not provide for a web server, express.js is used to fulfill the http needs of a Node web app. But since testing a web app route should happen in an isolated form and not require frequent re-starting of the server, supertest helps by starting the express.js server script and running the mocha tests on it.

Navigate to the test folder. Run "Mocha usertest.js"