Skip to content

Commit

Permalink
Step 8: Make the third test pass
Browse files Browse the repository at this point in the history
I expected this test to pass without changes, but it didn't!
To my surprise, destructured parameter assignment explodes
if the right side is null or undefined (this gives a good
error message in native v8, but when babelified the message
is not helpful).

Now, a decision: leave this gross `|| {}`, adding to the branching
complexity of the unit to mask over this language quibble, OR refactor
things around to push that complexity onto ensureDemonstration, so it
can effectively serve as the wrapper, throwing instead of returning a 
null or a default.
  • Loading branch information
searls committed Dec 23, 2017
1 parent d4f9662 commit d0afa13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/verify/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import warnIfAlsoStubbed from './warn-if-also-stubbed'
import fail from './fail'

export default function verify (__userInvokesDemonstrationHere__, config) {
const {double, call} = CallLog.instance.pop()
const {double, call} = CallLog.instance.pop() || {}
ensureDemonstration(call)
if (didCallOccur(double, call, config)) {
notifySatisfiedMatchers(double, call, config)
Expand Down

0 comments on commit d0afa13

Please sign in to comment.