Skip to content

devshafi/intro-nodejs-testing

Repository files navigation

πŸ§ͺπŸ§ͺ Intro to unit testing and API testing using javascript and nodejs πŸ§ͺπŸ§ͺ

Why testing

  • Reducing bug in production
  • Gain confidence in product
  • Can be used as documentation

Type of testing

type of testing image credit JavaScript testing best practice

We will know three types of testing

  • βœ… Unit testing
  • βœ… API testing (kind of integration testing)
  • β˜‘οΈ End to end testing (e2e)

The testing pyramid

type of testing

image credit https://www.headspin.io/

What we are using

  • Jest as test runner and assertion library.

    • Has both test runner (e.g. mocha) and assertion library (e.g. chai) integrated
    • We Need to familiar with matcher functions
  • Supertest for testing node.js HTTP server