mock-socket icon indicating copy to clipboard operation
mock-socket copied to clipboard

How to mock Apollo client to test graphql subscription

Open Ofrishani opened this issue 4 years ago • 1 comments

Does it work with apollo client? I'm trying to create mock client in cypress to graphql subscription, but apollo use ‘WebSocketLink’ instead of ‘WebSocket’ so it did not work. How can I use it with cypress and graphql?

Ofrishani avatar Dec 01 '21 11:12 Ofrishani

According to their documentation, you can provide a WebSocketImpl class if you don't want to use native one https://www.apollographql.com/docs/react/api/link/apollo-link-ws/#options

Atrue avatar Dec 06 '21 09:12 Atrue