menu
Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Platform
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team
Posts
Members
Info

How to test useLazyQuery?

I love the documentation about testing react components with useQuery and useMutation. (https://www.apollographql.com/docs/react/development-testing/testing/) But I struggle when testing the useLazyQuery-hook. …

thumbsup
2
message-simple
3

How do I get rid of these act console errors"

I'm converting my code to use apollo hooks and I'm running into problems when updating the unit test. I can't get rid of this no matter what I do. I've wrapped it in the act module and updated my version of react to latest to make sure I have the async version.

thumbsup
0
message-simple
2

How do I test that a mutation is run when using MockedProvider?

Hi! I'm working with React and Apollo. I have a component with a button that fires a mutation when clicked. I would like to write a test that confirms that when the button is clicked, the mutation is fired. Reading the docs on testing mutations there doesn't seem to be a way to…

thumbsup
4
message-simple
17

How to avail data when fetchPolicy: "cache-and-network" using MockedProvider

I have useQuery hook in my component as below. const { subscribeToMore, loading, error, data, refetch } = useQuery< getData …

thumbsup
0
message-simple
0

Is testing with Mock reliable?

I have a doubt in MockedProvider section https://www.apollographql.com/docs/react/development-testing/testing/#mockedprovider If we mock all the graphql request, it will pass the test suite. But, it might loss consistency with actual implementation. Hence, it results bug in…

thumbsup
0
message-simple
6

Testing react components - additional information.

https://www.apollographql.com/docs/react/development-testing/testing/#testing-loading-states The documented example doesn't mention why act errors appear, how to avoid them and also that providing an empty array of mocks results in an error object being defined. The act errors…

thumbsup
0
message-simple
0

Has anyone could able to figure out how to resolve this error?

Invariant Violation: Argument of passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document

thumbsup
0
message-simple
4

How to unit test the ApolloProvider from @apollo/react-hooks queries using…

When using MockedProvider in tests, I get the below error is there a different MockedProvider test-utils to test the version of the hooks? Currently, I'm testing it using with the below workaround …

thumbsup
1
message-simple
18

Has anyone been able to figure out how to resolve this error? 'No more mocked…

I am using jest and enzyme. I have, in my package.json file • "@apollo/react-hooks": "^3.1.0", • "@apollo/react-testing": "^3.1.2", …

thumbsup
0
message-simple
1

Testing with @client directives in queries

If we don't require a very specific set of mocked data, I like to use a 'mock client' that has been initialized using a mock schema created using the addMockFunctionsToSchema and makeExecutableSchema. This is VERY handy for running through the app with randomly generated data…

thumbsup
1
message-simple
0