Skip to content

Latest commit

 

History

History

0x06-unittests_in_js

img

 tests wont fail if you skip them

About

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

Resources

Read or watch:

  1. Mocha documentation
  2. Chai
  3. Sinon
  4. Express
  5. Request
  6. How to Test NodeJS Apps using Mocha, Chai and SinonJS

Learning objectives

  • 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