Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

BulbEnergy/jest-mock-examples

Repository files navigation

Jest mock examples

The purpose of this repo is to list examples of different types of mocking in Jest so anyone can use it as a reference.

It uses:

  1. Jest
  2. Typescript
  3. Prettier

If you have other useful examples or comments, please feel free to contribute.

Install: yarn

Run tests: yarn test

There are examples on how to use:

  • jest.mock and jest.unmock
  • jest.MockedFunction and jest.MockedClass
  • jest.spyOn
  • jest.genMockFromModule
  • jest.requireActual
  • mock fetch and other globals

About

Examples of mocks in Jest

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •