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:
- Jest
- Typescript
- 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
andjest.unmock
jest.MockedFunction
andjest.MockedClass
jest.spyOn
jest.genMockFromModule
jest.requireActual
- mock fetch and other globals