I'm testing `prisma.$subscription` in Jest, and I ...
# orm-help
r
I'm testing
prisma.$subscription
in Jest, and I get the
node()
return value, but it's not clear how to close the socket (from the prisma docs). Any clues?
h
I don't think this is currently possible. You can create a GH issue for this
r
@Harshit do you think there's anything I can hack into my code to force it to drop the connection? Even if it's forcing the server to stop?
In fact, how does prisma test subscriptions?
r
i dont think you should test in jest
h
Are you mocking or testing based on the response made by the server?
r
I mean don't test in React, rather just initiate post/get request and websocket connection to your graphql server
r
@Harshit I'm not mocking the graphql stuff, only the thing that the subscription does. Specifically, I'm sending an email on createUser mutation, so I want to test that this is happening (and not happening when certain criteria is met).
So my jest tests start a $test graphql server, and then start up the
subscription
which mostly works, except it leaves the socket open and I need to close it off
h
You can stop server using afterEach
r
@Harshit new issue https://github.com/prisma/prisma/issues/3955 - sorry, not super detailed 😕