Hey Guys,
I'm trying to write some tests for my subscriptions. I have an express server
My implementation is simple
SubscriptionServer.create({
schema,
execute,
subscribe,
onConnect: () => {
console.log(' connected ');
}
}, {
server,
path: '/subscriptions',
});
I'm using Redis pub/sub to subscribe and publish events
https://github.com/davidyaha/graphql-redis-subscriptions
Whats the best possible way to test this?
Do i have to make a separate websocket connection in my tests?
const client= new SubscriptionClient(`ws://localhost:3000/`, {
reconnect: true,
}, websocket);
and if i subscribe using SubscriptionClient, should that callback update with a response, if a pub/sub publish is called on that subscribe event.
Hi, i use SubscriptionClient on React-Native, and testing with Jest. It said:
Unable to find native implementation, or alternative implementation for WebSocket!
How we can mock and testing?
Can anyone help on this please?
do i create a WS with my express server?
wsServer = new WebSocket.Server({
server: myServer
});
that doesnt seem to work, it complains that TypeError: this.wsImpl is not a constructor
+1
Most helpful comment
Hi, i use
SubscriptionClienton React-Native, and testing with Jest. It said:How we can mock and testing?