-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple subscribers to a MockSubscriptionLink #6081
Allow multiple subscribers to a MockSubscriptionLink #6081
Conversation
@dfrankland: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
Codecov Report
@@ Coverage Diff @@
## master #6081 +/- ##
=======================================
Coverage 95.36% 95.36%
=======================================
Files 89 89
Lines 3664 3667 +3
Branches 903 871 -32
=======================================
+ Hits 3494 3497 +3
Misses 146 146
Partials 24 24
Continue to review full report at Codecov.
|
4617da1
to
f1786a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dfrankland!
The behavior of
MockSubscriptionLink
differs from that ofWebSocketLink
. Specifically,MockSubscriptionLink
doesn't allow multi subscriptions, which can make testing super confusing if you have a couple of components usinguseSubscription
.This PR adds an array of observables to
MockSubscriptionLink
for it to publish to when asimulateResult
orsimulateComplete
method is called. In its current form it can have a memory leak because the array of observables is never cleaned up. This was the case prior as well, but moving forward should we remove observables that are complete or encounter an error?