Unit testing is a software testing technique where individual units or components of a software application are tested in isolation to ensure that they perform as expected. The primary goal of unit testing is to validate that each unit of code (typically a function or method) behaves correctly and produces the expected results when given specific inputs. Unit tests help catch and prevent defects early in the development process, leading to more reliable and maintainable software
Read or watch:
- Mocha documentation
- Chai
- Sinon
- Express
- Request
- How to Test NodeJS Apps using Mocha, Chai and SinonJS
- How to use Mocha to write a test suite
- How to use different assertion libraries (Node or Chai)
- How to present long test suites
- When and how to use spies
- When and how to use stubs
- What are hooks and when to use them
- Unit testing with Async functions
- How to write integration tests with a small node server