/Testing-with-Jest

Playing around with jest test to help the community of fellow engineers

Primary LanguageTypeScript

Testing with Jest - ES6 class mocks

Navigations

Testing-with-Jest

Folder Structure

  • /src
    • db - (Database/models layer)
      • redis.ts
    • tests - Test cases
      • Company.test.ts
      • Employee.test.ts
    • Company.ts
    • Employee.ts

Prerequisites

Node 18.14.1

Startup Guide

  • Clone the repo and
  • Install the dependencies to setup your sustem to run the tests
        yarn install
    
  • Checkout the respective branch as you follow along the article

Testing

  1. Test single file

       yarn test <regex> Or path to file
    
       e.g To test Company file tests
       yarn test /Company
    
    
  2. Test entire test suites

       yarn test
    

Resources