-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Adding async versions of mockReturnValue & mockreturnValueOnce #5318
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5318 +/- ##
==========================================
+ Coverage 61.29% 61.33% +0.03%
==========================================
Files 205 205
Lines 6917 6924 +7
Branches 3 3
==========================================
+ Hits 4240 4247 +7
Misses 2676 2676
Partials 1 1
Continue to review full report at Codecov.
|
5ae2641
to
a54b9e1
Compare
@m4n3z40 Thanks for the PR, and sorry about the slow review! I started writing it, but I just ended up fixing my code nit in order to ensure it worked like I wanted. I rebased your branch and added my change, the assertions read a bit nicer this way 🙂 |
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.
Please update the changelog and mock
documentation.
Awesome. Wasn't aware that all jest features were available in it's own test suite. Very neat, thanks. Added changes to CHANGELOG and docs. |
Just noticed eslint is failing because of the async examples I've added. :( |
The doc about |
Fixed in #5373, isn't it? |
uups, didn't see it :) |
No worries, thanks for checking! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
I find myself doing the following very often when testing async code:
This PR adds four utility methods to
MockInstance
, automating the creation of async mock functions:Test plan
NA (Not a bug)
This PR means to gather info on usage first, if people find this useful I'll continue to add the docs to this feature and updating the changelog as needed.
Thanks!