testing node js api using chai and mocha
first following the step for installing mocha and chai
- npm install mocha --save-dev
- npm install chai --save-dev
- npm install chai-http --save-dev
- go to the package.json file and write in scripts "test": "mocha"
- then create a folder and create a file (like api.js) and code your testing
- Write npm test in terminal for testing the test
for better understanding you can try below link for understanding how mocha and chai work and how we write testing code for test our application------
https://www.digitalocean.com/community/tutorials/test-a-node-restful-api-with-mocha-and-chai
Top comments (0)