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

MockedProvider: How to handle multiple requests that have same variables?

Example based on https://www.apollographql.com/docs/react/development-testing/testing/ });

thumbsup
0
message-simple
2

Why use MockedProvider when I can spyOn 'useQuery'?

After struggling for hours on implementing MockedProvider into my test setup (it is still not working and query results are undefined) I was asking myself why to use the MockedProvider in the first place and not just provide a mocked return value for the useQuery鈥

thumbsup
0
message-simple
0

What is the proper way to wait for reactive variables in tests?

I asked a question on StackOverflow with all the details and examples: Can someone have a look and answer the thread? https://stackoverflow.com/questions/63880395/what-is-the-proper-way-to-wait-for-reactive-variables-in-tests

thumbsup
0
message-simple
0

MockedProvider test only passes when other is skipped

I have Test A that only passes when the other test, Test B is set to skip. It seems as if the mock isn't getting cleared or something? (Using React testing library.)

thumbsup
0
message-simple
4

UseQuery with @client and reactive var doesn't work with MockedProvider

Mocking queries which use @client directive and are defined in MemoryCache using reactive variables doesn't return anything when using MockedProvider. How are you now supposed to mock queries, there is no documentation on this. This also all used to work before upgrading to v3鈥

thumbsup
0
message-simple
0

How to mock local state client query?

I'm writing some tests using Jest and react-testing-library. All my mocks are working just fine, except when I try to mock a @client query. It always returns an empty object. When I remove the @client directive, the test passes just fine, but then I get console errors on my鈥

thumbsup
3
message-simple
1

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
20

Mockedprovider returning duplicate elements during pagination

Hey folks, I wrote a pagination hook using Apollo client and I'm seeing duplicated elements in my tests. Basically I'm trying to click forward and then back, and assuming the output should be one, then two, then one. instead I'm getting one, two, one one two: repro is here:鈥

thumbsup
0
message-simple
0

Testing Local Cache Update

Not sure if this is the right place to post this question. Does anyone have an example of how to test a delete mutation which updates cache with read query and write query and removed one item from the cache. I am passing the cache to the MockProvider but i keep seeing error鈥

thumbsup
0
message-simple
0

How can I spyOn the Mutation function that is called?

My react component calls the GQL Mutation hook when a form is submitted. The onSubmit is part of a renderProp in Formik so I don't have access to this function. Once it's submitted, the component unmounts. Rather than mock the data returned and test the E2E flow, I find it more鈥

thumbsup
0
message-simple
0