This is an exercise project to support an introductory workshop around writing automated unit and integration tests for a Node application, in JavaScript.
Since you're reading this README
, you've either cloned the project repository already or at least know where to get it. Once you have a fresh copy on your computer, do the following:
-
Install
node
- Either using a package manager: https://nodejs.org/en/download/package-manager/
- Or going old school: https://nodejs.org/en/download/
-
Install the project's dependencies:
$ npm install
-
Try to run the existing suite of tests:
$ npm test
If you see mentions of tests passing and no glaring errors, you're probably good to go!
Having said that, you might want to confirm that the "application" starts up normally outside of the test harness as well:
-
Spin up the application server:
$ npm start
You should see a mention of
Express running
andPORT 4000
.
Feel free to browse the code that's already in place.
Since JavaScript tools' autocompletion is what it is, you'll probably find yourself perusing the API docs for your chosen assertion library more frequently than you'd like. Here's a menu of what we're already using in different parts of the project:
- Node's built-in
assert
module (used in a few sample tests): chai
assertions (used in our unit tests):jest
assertions (used in our integration tests):supertest
(used in our integration tests):