-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
MockedProvider gives incorrect error message with undefined variables #6688
Comments
To be completely honest with you, we did not get around to improving our testing/mocking utilities in AC3, but they are badly in need of an update, and this is a great example of a shortcoming in how the mocking utilities match queries/variables. Thanks for opening this issue! |
I've been running into the same issue a lot lately. What helped me was to monkey patch the testing.js file with the contents of this old pr: https://github.com/apollographql/react-apollo/pull/2883/files With that you get a proper diff on what is expected vs what was actually found in your mocks |
See benjamn/wryware#21 for explanation and motivation. Should help with #6771, #6803, #6688, #6378, and #7081, and possibly other regressions that began in @apollo/[email protected].
See benjamn/wryware#21 for explanation and motivation. Should help with #6771, #6803, #6688, #6378, and #7081, and possibly other regressions that began in @apollo/[email protected].
This behavior should be fixed/improved in |
It doesn't sound like there is an outstanding issue here, so closing. Thanks! |
Intended outcome:
MockedProvider error message correctly describes GraphQL request missing a mock when no matching mock present
Actual outcome:
Note that the query I am sending actually has
b: undefined
in the variables, and that's why the mock (which did not includeb
in the variables) did not match, butMockedProvider
did not tell me this.How to reproduce the issue:
Set up a mock for a query that takes an optional variable, pass undefined to it in your code, but omit it from
variables
in your mock. It will fail to match, but the error message will not mention it.Versions
The text was updated successfully, but these errors were encountered: