https://github.com/arwl2016/node-tests
Udemy course projects - Andrew Mead: Complete Node
https://github.com/arwl2016/node-tests
expect mocha rewire supertest testing
Last synced: about 2 months ago
JSON representation
Udemy course projects - Andrew Mead: Complete Node
- Host: GitHub
- URL: https://github.com/arwl2016/node-tests
- Owner: ARWL2016
- Created: 2017-01-07T12:28:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-28T04:31:21.000Z (over 9 years ago)
- Last Synced: 2025-03-24T07:57:10.025Z (over 1 year ago)
- Topics: expect, mocha, rewire, supertest, testing
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Complete Node Developer Course (Udemy: Andrew Mead) - Node Tests
https://www.udemy.com/the-complete-nodejs-developer-course-2/learn/v4/content
https://github.com/ARWL2016/node-tests
https://github.com/ARWL2016/compendium/blob/master/reviews/testing
This module is a demonstration of basic testing methods in Node. It also covers rewire and spies. This part is not clear.
#### Featured Libraries
1. Mocha 3.0.0 - test framework
2. Expect 1.20.2 - assertion library
3. Supertest 2.0.0 - for testing http requests
4. Rewire 2.5.2 - dependency injection
#### Notes
1. Mocha is not required in a test file. It is used to run tests and define test files - see package.json. It provides the *describe* and *it* structure.
2. The basic structure of an expect assertion is `expect().toBe()`
3. Supertest allows us to make request of the app through a particular route and then expect a particular response. Note that we pass in done to make the test asynchronous.