strong-mock
shoehorn
strong-mock | shoehorn | |
---|---|---|
4 | 3 | |
92 | 429 | |
- | 1.2% | |
7.5 | 5.7 | |
13 days ago | 2 months ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
strong-mock
-
libraries you are happy that you discovered them
Shameless plug, but feel free to try https://github.com/NiGhTTraX/strong-mock as an alternative.
- strong-mock: Type safe mocking library for TypeScript
-
"as unknown as Promise<Response>" if you don't want to mock the whole Response object
If checking that getData is called using the correct input, consider using strong-mock.
-
How do you test an Axios call to a GraphQL API in React?
Depending on how you want to check the call, you might want to use a spying library (sinon, jest.fn etc). Check out strong-mock if you're using TypeScript.
shoehorn
-
Partial: how not to mock the whole world
Yeah, the last line is 🤮 and one can improve it with utilities like shoehorn hiding all complexity underneath.
-
I hate mocking Typescript classes with Jest
You might like shoehorn, which allows you to do partial mocks: https://github.com/total-typescript/shoehorn
-
Unleash the power of Partial <T> for mock data perfection!
There's one more approach that I have recently come across by none other than our Typescript Wizard: Matt Pocock. He's created a library called shoehorn that has some utility types. Head over to his article and read more about it.
What are some alternatives?
ts-mockito - Mocking library for TypeScript
jest-typescript-mock-reference
mock-inspect - Mocks network requests and allows you to make assertions about how these requests happened. Supports auto-mocking of graphQL requests given a valid schema.
interface-forge - Graceful mock-data and fixtures generation using TypeScript
data - Data modeling and relation library for testing JavaScript applications.
graphql-tools - :wrench: Utility library for GraphQL to build, stitch and mock GraphQL schemas in the SDL-first approach
wonka - 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
shallow-render - Angular testing made easy with shallow rendering and easy mocking. https://getsaf.github.io/shallow-render
ng-mocks - Angular testing library for mocking components, directives, pipes, services and facilitating TestBed setup
next-testing-api - Next API Test Suite 🚀 Simplifying the mocking and asserting of Next API Request & Responses
fp-ts - Functional programming in TypeScript
msw - Seamless REST/GraphQL API mocking library for browser and Node.js.