apollographql / apollographql/graphql-testing-library

Subscription redundant wrapper

Open
#164 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
61
Forks
2
PR merge metrics
No merged PRs in 30d

Description

See here https://github.com/apollographql/graphql-testing-library/blob/05fed23d8414abef1cb00f70ec2cbee121f477c6/demo/server/src/index.ts#L191

This should be `pubsub.publish("NUMBER_INCREMENTED", currentNumber)` instead. The wrapper object contains the subscription name.

Also it would be good to have some sort of lightweight pubsub for testing. https://github.com/apollographql/graphql-subscriptions is too much for me and actually unusable because there's no built-in browser api, it uses node's `events` package which I don't have in the browser tests. I do happen to have rxjs, so I'm using that, I did have to pull in some async iterator converter though. And I also don't need the event name, I just want to publish the same type of event for this particular subscription.

Maybe rethink the api for subscription? Not even sure what the "resolve" method is for and having the underlying "subscribe" is unintuitive. Maybe just accept what subscribe accepts or just the pubsub api you come up with

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at demo/server/src/index.ts around line 191 and inspect how the subscription wrapper and underlying subscribe/resolve API are used. Define a browser-compatible lightweight pubsub approach and clarify the subscription API, with completion requiring direct event payloads and behavior that works in the browser testing setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.