Hi there, I want to write tests to my subscriptions but I don’t hace a clue on how to start, because the documentation doesn’t give any examples about it. Using React as front end framework
Seems good but I’d like to test the function that I have written in the onSubscriptionData and there are queries in the component that I’d like to test, so I need to use the MockedProvider in my opinion isn’t it?
and also it seems that the combination of testing subscriptions and using wait (setTimeout with 0) make a heap overflow
Yeah the difficulty is trying to use MockedProvider for a component that uses both useQuery and useSubscription.
It’d be really nice if there was a way to provide mocks for queries / mutations / subscriptions to MockedProvider, and then decide in the test when to manually trigger a subscription event.
At the moment this isn’t possible, and is definitely one of the biggest pain points with apollo client.
Totally agree! We need a mechanism to trigger a subscription event.