Mocking Apollo Client for iOS UI Test

Hello,

I’m using the Apollo Client in my native iOS project and I would like to know… Does anyone know if there is such a thing as “import { MockedProvider } from '@apollo/client/testing’;” (React) or “testImplementation("com.apollographql.apollo3:apollo-mockserver:3.2.0”)” (Kotlin) for the Apollo Client for iOS?
If that doesn’t exist yet, can you please share some ideas about how you’re mocking the client and writing UI Tests for your app?

Thanks in advance!

Hi @Amanda_Ragone :wave: - you mentioned native iOS but also React and Kotlin. We have clients for each of those stacks (apollo-ios, apollo-kotlin and apollo-client) and they will all have different ways to enable mocking. Could you share a bit more about your stack so we can point you to the right client - thanks.

Hi @calvincestari , thanks for your reply and sorry for the confusion. I am looking for a way to mock the iOS client for my project. I couldn’t find that in the iOS Client documentation.

Hi @calvincestari , I just want to follow up and check if you’ve seen my response above. Please let me know if you need any additional details.

Hi @Amanda_Ragone - you’re correct, there isn’t any documentation on mocking the apollo-ios client unfortunately. It’s also not something that is particularly easy in apollo-ios either. It can be done but you’ll need to mock out the classes it uses too, such as the transport stack.