-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: adding types to jest matchers #880
Conversation
5a05979
to
9e41a81
Compare
This is really great - thanks so much for the contribution 🙌 It will also need an update to the docs to explain that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As documented here:
filter and options are the same as those used by fetchMock.callHistory.calls().
And calls()
's two arguments are optional:
calls(filter?: CallHistoryFilter, options?: RouteConfig): CallLog[] { |
filter: CallHistoryFilter, | ||
options: UserRouteConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure filter
and options
should be optional here?
filter: CallHistoryFilter, | ||
options: UserRouteConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
filter: CallHistoryFilter, | ||
options: UserRouteConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@Yihao-G - if you think there is an issue with an already merged PR, I would encourage you to open an issue or submit your own PR. People normally don't look at their old merged PRs |
I just wanted to double confirm though 😄 - I'm happy to make a PR if you guys think those two parameters should be optional |
Summary
This adds types to describe the FetchMockAdapters and updates the jest Expect object so that typescript and intellisense can provide correct typings. It also adds some typings to the extension.js code so that, if something changes, we'll see that the types fail to compile and we can make updates as needed.
Update - Additional Commit
This commit keeps support for the "patched fetch" and also adds support for FetchMock like the documentation details. It adds tests for both inputs and adds an error message if the input is neither FetchMock or a patched fetch instance.