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

Missing MockLink (or similar) in vue-apollo #1003

Closed
cilice opened this issue Jun 14, 2020 · 0 comments
Closed

Missing MockLink (or similar) in vue-apollo #1003

cilice opened this issue Jun 14, 2020 · 0 comments

Comments

@cilice
Copy link

cilice commented Jun 14, 2020

Is your feature request related to a problem? Please describe.
Apollo for React has https://www.apollographql.com/docs/react/development-testing/testing/, which implements a MockLink in here: https://github.com/apollographql/apollo-client/blob/master/src/utilities/testing/mocking/MockedProvider.tsx (this is the link to the apollo v3 version, but it's similar for v2)

Adding that unfortunately doesn't work nicely since it has a dependency on React.

Describe the solution you'd like

I'd like to add an "official" MockLink in vue-apollo, or a way to create a testing client which you can use.

Something like import { createMockClient } from '@vue/apollo-testing' would be ideal.

Describe alternatives you've considered
I've copied the code from MockLink into an own package so it doesn't depend on React, which works well internally at @sumcumo. Additionally, there is also https://github.com/Mike-Gibson/mock-apollo-client/, which works in a different way than the MockLink.
Suggesting stubbing apollo in tests is in my opinion a bad practise, see https://kentcdodds.com/blog/stop-mocking-fetch

This applies for both, v3 and v4.

I'm happy to work on it to provide a PR for both, v3 and v4, as well, if you think that it would belong to this library.

@cilice cilice changed the title Add MockLink (or similar) to vue-apollo Missing MockLink (or similar) in vue-apollo Jun 14, 2020
@cilice cilice closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2023
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

1 participant