Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /