Closed jeyj0 closed 5 years ago
Merging #8 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #8 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 53 60 +7
=====================================
+ Hits 53 60 +7
Impacted Files | Coverage Δ | |
---|---|---|
src/when.js | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update cac87b8...1ced75a. Read the comment docs.
Released as v2.1.0. Thanks!!!!!!!
I went for the proposed syntax:
It was easier to implement and looks more like jest, in hindsight.
One notable thing: when using the default without a
.calledWith(..)
, an error is thrown once the mocked function is called, as it 1. won't work, and 2. is unnecessary - one could simply use jest's default mocking in this case. This was a subjective change, and could be taken out. If one would replace the implementation with thethrow
, with one that returns the default value, that should make it work, but I'd encourage users to use jest's default mocking for that.If however this behavior is liked, it'd be super easy and reduce complexity to throw the error when only using
when(..)
without anything else as well. :smile: