Skip to content

Using graphql-ws client in tests #336

Answered by enisdenjo
Morishiri asked this question in Q&A
Discussion options

You must be logged in to vote

How do I know for sure that the subscribe is done and I can run the mutation?

As in the subscribe was successful but the subscription is not completed yet? In that case, I recommend using ServerOptions.onOperation.

On the other hand, if you mean that the subscription really completed and no further events will be emitted - simply use the sink as showcased in the "Client usage with Promise" recipe and wait for the Promise to resolve.

How do I test for that? error in subscribe call doesn't seem to be called in that situation and I'm simply getting timeout in tests, because promise is not resolving..

The client is probably retrying. Consider setting the ClientOptions.retryAttempts to zer…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Morishiri
Comment options

@enisdenjo
Comment options

Answer selected by Morishiri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants