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

Add ability to set custom MockProviders #2298

Open
jvanbaarsen opened this issue Apr 16, 2021 · 3 comments
Open

Add ability to set custom MockProviders #2298

jvanbaarsen opened this issue Apr 16, 2021 · 3 comments
Labels
bug/confirmed We have confirmed this is a bug help wanted topic/testing

Comments

@jvanbaarsen
Copy link
Contributor

We have the option to allow users to set their own Query provider instead of Apollo, this works great in production code, but once you're entering testing territory you run into problems.

For Apollo we have a MockProviders function in MockProviders.tsx, this function sets the RedwoodApolloProvider.

To make "Bring your own query provider" more a first class experience we probably want to come up with a solution to be able to either override the RedwoodApolloProvider in MockProviders.tsx, or allowing users to set their own MockProviders.

@jvanbaarsen
Copy link
Contributor Author

jvanbaarsen commented Apr 16, 2021

I now fixed it by using this work-around: https://gist.github.com/jvanbaarsen/30a6314e017b01da4a0ad1c4ff98514f.

I can now import this in my tests instead of the render from redwoodjs/testing. This however doesn't feel like a solid solution, and more of a temporary hack.

@dac09 dac09 added bug/repro-available A reproduction exists and needs to be confirmed topic/testing labels Apr 21, 2021
@dac09
Copy link
Collaborator

dac09 commented Apr 21, 2021

Thanks @jvanbaarsen for raising this. Pretty valid point! Will try to prioritise next release (v0.32)

@jtoar jtoar mentioned this issue May 20, 2021
@jtoar jtoar removed the help wanted label Jun 5, 2021
@thedavidprice thedavidprice added the bug/confirmed We have confirmed this is a bug label Sep 29, 2021
@jtoar jtoar added help wanted and removed bug/repro-available A reproduction exists and needs to be confirmed labels Dec 10, 2021
@jtoar
Copy link
Contributor

jtoar commented Dec 12, 2021

Seems related to #2359.

@jtoar jtoar added next and removed v1/priority labels Feb 15, 2022
@jtoar jtoar removed the next label May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug help wanted topic/testing
Projects
Status: Backlog
Development

No branches or pull requests

4 participants