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

Consider replacing mock link with wildcard-mock-link #298

Open
insidewhy opened this issue Jun 11, 2021 · 1 comment
Open

Consider replacing mock link with wildcard-mock-link #298

insidewhy opened this issue Jun 11, 2021 · 1 comment
Labels
🧪 testing Feature requests related to testing

Comments

@insidewhy
Copy link

insidewhy commented Jun 11, 2021

Apollo's mock link for react is okay for basic testing but needs a lot of improvements, particularly when it comes to dealing with subscriptions. It's also impossible to assert against requests that were made or write mocks that can match requests using arbitrary variables.

wildcard-mock-link is fully compatible but with the following features added:

  • Match requests with arbitrary variables.
  • Provide mocks that match more than one request.
  • Mock subscriptions and send subscription responses after setting up the MockedProvider in a test via method calls.
  • Grab the mutation/query/subscription requests for use in test assertions.
  • Can optionally pass act function to it in order to simplify writing tests.
  • Ability to wait for pending requests to be fulfilled, including recursively dependent requests.

It's also fully tested and documented.

@jpvajda
Copy link
Contributor

jpvajda commented May 25, 2022

@jpvajda jpvajda added the project-apollo-client (legacy) LEGACY TAG DO NOT USE label May 25, 2022
@jerelmiller jerelmiller added the 🧪 testing Feature requests related to testing label Apr 6, 2023
@jerelmiller jerelmiller removed the project-apollo-client (legacy) LEGACY TAG DO NOT USE label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧪 testing Feature requests related to testing
Projects
None yet
Development

No branches or pull requests

3 participants