You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to verify that a testdouble object is called with an argument of another testdouble, it might be nice to show the name of the argument testdouble in the error message. An example:
Error: Unsatisfied verification on test double `named_bar`.
Wanted:
- called with `(undefined)`.
But there were no invocations of the test double.
It could be useful if the error message instead had the line:
- called with `(named_foo)`.
This is related to a twitter conversation where toString() is also mentioned; I'm not 100% sure how that plays into it but that will probably become clear when I check out the source a bit more.
The text was updated successfully, but these errors were encountered:
Don't worry about the toString() stuff, I was being overly paranoid. Since a testDouble itself is just a function, I'd add a toString() prop to it to implement this (in the event that a name is set).
> foo = function(){}
> foo.toString = function() { return 'such a foo'; }
> s = "hi" + foo + "bye"
'hisuch a foobye'
So my vote is that wherever we're setting the name now, also add a quick testDouble.toString ||= -> name
If I want to
verify
that a testdouble object is called with an argument of another testdouble, it might be nice to show the name of the argument testdouble in the error message. An example:Given:
the error message will be:
It could be useful if the error message instead had the line:
This is related to a twitter conversation where
toString()
is also mentioned; I'm not 100% sure how that plays into it but that will probably become clear when I check out the source a bit more.The text was updated successfully, but these errors were encountered: