Deferred are not always 100% resolved/called.
You might have a deferred called, but the current result might be
another deferred... so it has no final result yet.
----
so in your case, instead of `returnValue(result)` use
result = yield result
returnValue(result)
in this way, the result is resolved :)
The methods being hooked don't necessarily return deferreds.
I'd like it to be an explicit choice of the caller, ie:
result = yield SomeProtocol.onMessage.called()
# okay, we got here, we know onMessage was called,
# now we might want to tick a clock, or otherwise simulate
# async state manipulation.
# now I want to make sure the deferred chain on the onMessage result has been completed:
yield result