Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow argument matchers to enhance failure messages #59

Closed
searls opened this issue Nov 27, 2015 · 5 comments
Closed

Allow argument matchers to enhance failure messages #59

searls opened this issue Nov 27, 2015 · 5 comments

Comments

@searls
Copy link
Member

searls commented Nov 27, 2015

I was a little disappointed by this:

eatBiscuit(44)

td.verify(eatBiscuit(td.matchers.isA(Date)))

Error: Unsatisfied verification on test double.

  Wanted:
    - called with `({})`.

  But was actually called:
    - called with `(44)`.

It really seems like the isA matcher should have and use a hook to report something such that we'd see:

  Wanted:
    - called with `([something of type 'Date'])`.
@searls
Copy link
Member Author

searls commented Nov 27, 2015

(The same goes for all the built-in matchers; the real work here is the hook to modify the argument description)

@samjonester
Copy link
Contributor

This looks like it's already completed, unless there is more you'd like to include with this ticket:

https://github.com/testdouble/testdouble.js/blob/master/src/stringify/anything.coffee#L13
https://github.com/testdouble/testdouble.js/blob/master/src/matchers/index.coffee#L21

@searls
Copy link
Member Author

searls commented Nov 7, 2016

Do we have a test for something like I pointed out at the top?

@samjonester
Copy link
Contributor

@searls
Copy link
Member Author

searls commented Dec 14, 2016

This was indeed fixed when we changed the matchers format to have a name property.

@searls searls closed this as completed Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants