menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

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 Studio
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
Hugh Willson
@hwillson
Ellen Shapiro
@designatednerd
Jesse Rosenberger
@abernix
Jake Dawkins
@jakedawkins
Martin B
@mbonnin
James Baxley
@jamesbaxley
Jason Paulos
@jasonpaulos
Julia Black
@juliablack
Khalil Stemmler
@khalilstemmler
Martijn Walraven
@martijnwalraven
Jenn Creighton
@jenncreighton
Peggy Rayzis
@peggy
Ben Church
@bnchrch
Trevor Scheer
@trevor-scheer
Danielle Man
@daniman
Adam Zionts
@zionts
Evans Hauser
@evans
Stephen Barlow
@stephen-barlow
Ashi Krishnan
@rakshesha
Chang Wang
@cheapsteak
Michael Watson
@michael-watson
Thao
@thao
Justin Anastos
@justin-anastos
Tim Hingston
@timbotnik
Adam Torres
@adamatorres
Alisha Ehrlich
@alisha-ehrlich
Claire Hough
@clairehough
David Glasser
@glasser
François Dufour
@francois-dfr
Matt DeBergalis
@debergalis
Sachin D. Shinde
@sachin-shinde
Posts
Members
Info

Mutation not updating graphql cache when using MockedProvider

In a non-testing environment for my React Apollo apps, when a mutation returns with some new data, the graphql cache will be updated, which then causes component to re-render and display the new data. But I've never been able to replicate that when testing using MockedProvider.…

thumbsup
0
message-simple
0

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
8

MockedProvider mocks are impossible to maintain

I'm really thankful for Apollo and the MockedProvider utility. Both great tools. The issue I'm currently having though is that I'm finding it way too time consuming trying to maintain my mocks. How can I debug the MockedProvider constantly returning nothing? It has been taking…

thumbsup
1
message-simple
0
Deleted·32d# Testing

apollo-datasource-rest + Typescript + Jest

I am setting up a new project using Apollo, TypeScript & Jest and I'm running into some difficulty testing my datasources that extent RESTDataSource. Jest will not mock the class to be extended & much of the advice I'm coming across recommends switching to composition over…

thumbsup
2
message-simple
4

MockedProvider error Could not find "client"

Updated to @apollo/client/testing from @apollo/react-testing. Changed import { MockedProvider } from '@apollo/client/testing'; Still we have an error while running jest tests "Invariant Violation: Could not find "client" in the context or passed in as an option. Wrap the root…

thumbsup
0
message-simple
0

Mutation doesn't resolve in Jest test

Getting the following error: Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout. The console.log('created log') never runs. I've been stuck on this for two days, so any help would be hugely appreciated! The test: …

thumbsup
0
message-simple
0

Fragment is not working with MockedProvider

When I use a fragment in my code, it works in a browser environment, but it fails in the tests when using MockedProvider from Apollo. If my Fragment looks like this: My fragment looks like this: …

thumbsup
1
message-simple
5

fields contained in fragment are not being returned from mocks

Intended outcome: I'm trying to write some tests that involve some queries that contains fragments in them. The fields in the fragments get retrieved just fine in the local environment, but when I try to run it through jest, I get back all the fields except for the ones in the…

thumbsup
1
message-simple
1

MockedProvider never returns any data

[email protected] with testing-library/[email protected] i am using useLazyQuery and in test mode it never resolves. loading is always true and data always undefined. My mock query and variables match exactly the query and variables used in the component i am testing, yet i still get no…

thumbsup
0
message-simple
1

withApollo `TypeError: Cannot read property 'query' of undefined`

libraries used Component setup Unit Test …

thumbsup
1
message-simple
2