https://github.com/voodoocreation/jest-mocks
A set of useful mocks and helpers for the Jest unit testing framework.
https://github.com/voodoocreation/jest-mocks
async-functions async-jest-mocks async-mocks frontend frontend-test frontend-testing jest jest-mocks mock mock-function mock-functions mocks promises test testing tests unit-test unit-testing unit-tests
Last synced: 2 months ago
JSON representation
A set of useful mocks and helpers for the Jest unit testing framework.
- Host: GitHub
- URL: https://github.com/voodoocreation/jest-mocks
- Owner: voodoocreation
- Created: 2019-12-16T05:46:11.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T05:26:47.000Z (about 2 years ago)
- Last Synced: 2025-03-01T01:41:12.306Z (3 months ago)
- Topics: async-functions, async-jest-mocks, async-mocks, frontend, frontend-test, frontend-testing, jest, jest-mocks, mock, mock-function, mock-functions, mocks, promises, test, testing, tests, unit-test, unit-testing, unit-tests
- Language: TypeScript
- Size: 1.04 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Jest Mocks
==========A set of useful mocks and helpers for the Jest unit testing framework.
Available helpers
-----------------All provided helpers have full TypeScript support with inferred types based on the arguments
they're called with.### `filterMockCalls(mock, ...args)`
Returns an array of calls from the provided Jest Mock, where `args` matches the args the mock was
called with.### `findMockCall(mock, ...args)`
Returns the first matching call from the provided Jest Mock, where `args` matches the args the mock
was called with.### `resolvedPromise(value)`
Returns a `Promise` that will instantly resolve with the provided `value`.### `rejectedPromise(error)`
Returns a `Promise` that will instantly be rejected with the provided `error`.### `mockWithResolvedPromise(value)`
Returns an `async` Jest Mock that will instantly resolve with the provided `value` when called.### `mockWithRejectedPromise(error)`
Returns an `async` Jest Mock that will instantly be rejected with the provided `error` when called.