← ClaudeAtlas

graphql-subscription-test-authorlisted

Use when GraphQL subscriptions need tests over graphql-ws (WebSocket) or graphql-sse: subscribing through the async iterator, asserting event shape and order, connection lifecycle and close codes, auth on connect and pubsub triggers. Queries and mutations belong to the server test skills.
testland/qa-skills · ★ 0 · API & Backend · score 72
Install: claude install-skill testland/qa-skills
# graphql-subscription-test-author ## Overview Per the GraphQL October 2021 spec (section 6.3, blocked by Cloudflare Turnstile - cite by stable ID "GraphQL October 2021 spec, Section 6.3: Subscription"), a subscription operation must: select a single root field, return an event stream, and emit one result per event. Each emitted result is executed independently against the schema, exactly like a query. This skill covers testing the transport and resolver layers for subscriptions. The two most common Node.js transports are: - **graphql-ws** - WebSocket subprotocol `"graphql-ws"` (per [the-guild.dev/graphql/ws](https://the-guild.dev/graphql/ws)) - **graphql-sse** - HTTP Server-Sent Events (per [the-guild.dev/graphql/sse](https://the-guild.dev/graphql/sse)) Both expose an identical async-iterator surface via `client.iterate()`, making the same test patterns portable across transports. ## When to use - Writing tests for subscription resolvers (pubsub trigger, filter, error). - Asserting connection lifecycle: handshake, auth rejection, protocol close. - Verifying auth-on-connect: `connectionParams` (WS) or `authenticate` callback (SSE) reject unauthenticated clients before any event is sent. - Integration-testing that event-stream shape matches the schema contract. Distinct scope vs. sibling skills: - `apollo-server-tests` covers queries/mutations via `executeOperation`; its Limitations section explicitly notes "Doesn't test subscriptions over WS." - `graphql-yo