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

More helpful failed verifications panic messages #62

Open
sjud opened this issue Mar 23, 2021 · 2 comments
Open

More helpful failed verifications panic messages #62

sjud opened this issue Mar 23, 2021 · 2 comments

Comments

@sjud
Copy link

sjud commented Mar 23, 2021

Hello,
I think having clearer failed verification messages would make debugging multiple chained .and(matcher) calls easier. For example:
Mock::given(header_exists("X-Postmark-Server-Token"))
.and(header("Content-Type", "application/json"))
.and(path("/email"))
.and(method("POST"))
.and(SendEmailBodyMatcher)
Fails with:
thread 'email_client::tests::send_email_sends_the_expected_request' panicked at 'Verifications failed:

  • Mock #0.
    Expected range of matching incoming requests: == 1
    Number of matched incoming requests: 0

As opposed to specifying which matcher in particular failed.

@longfellowone
Copy link

This would be very useful!

@LukeMathWalker
Copy link
Owner

I agree this would be quite useful, but there are some challenges to the implementation 😅
For the time being, my recommendation would be to always use the named method on your Mocks to make it easier to pinpoint what didn't work as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants