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

[Testing utilities] Custom fetch implementation via context #11710

Closed
alessbell opened this issue Mar 20, 2024 · 5 comments · Fixed by #11605
Closed

[Testing utilities] Custom fetch implementation via context #11710

alessbell opened this issue Mar 20, 2024 · 5 comments · Fixed by #11605

Comments

@alessbell
Copy link
Contributor

alessbell commented Mar 20, 2024

Issue Description

@phryneas had a great idea here: instead of requiring users to use an test env-specific terminating link of SchemaLink, use a custom fetch implementation via context that effectively turns HttpLink into a SchemaLink.

Link to Reproduction

N/A

Reproduction Steps

No response

@apollo/client version

N/A

@alessbell alessbell added this to the Schema-driven testing milestone Mar 20, 2024
@alessbell
Copy link
Contributor Author

@jerelmiller also had an idea here around setting a threshold (min/max) values for response timing

@jerelmiller
Copy link
Member

Yes! To write it out, we want to mimic a real client/server interaction as much as possible, which means that there will always be variable latency in the request. We absolutely DON'T want the mocked request to be synchronous because a network request is always asynchronous (something we see too often in MockedProvider unfortunately). Allowing a min/max for response timing allows us to randomize the synthetic latency to better mimic a production environment. This also provides better guarantees that your tests aren't passing purely because the request timing is favorable.

@alessbell
Copy link
Contributor Author

Completed via #11605

Copy link
Contributor

github-actions bot commented Apr 3, 2024

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

Copy link
Contributor

github-actions bot commented May 4, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants