Adding async versions of mockReturnValue & mockreturnValueOnce#5318
Adding async versions of mockReturnValue & mockreturnValueOnce#5318cpojer merged 5 commits intojestjs:masterfrom
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 🙂 |
|
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!