Open ddebrunner opened 1 month ago
The example client iterator code is here:
https://github.com/enisdenjo/graphql-ws/blob/master/website/src/pages/get-started.mdx?plain=1#L195-L196
and reads as though the value returned from query.next() is the data element of the GraphQL response.
query.next()
data
But using the client query.next() with a GraphQL server returns a higher level object:
{"value":{"data":{"user":{"id":"100","name":"Pascale","email":"veldaparker@weimann.biz"}}},"done":false}
The tests added by #486 also show that the value returned is the higher-level object: https://github.com/enisdenjo/graphql-ws/blob/master/src/__tests__/client.ts#L2355-L2361
Maybe I'm missing something, I'm not a javascript/typescript expert so maybe there's some magic going on with the test harness and expect, but I found the mismatch confusing with what value was expected to be returned.
expect
Ah you're right! There should be data. You interested in making a PR? 😄
The example client iterator code is here:
https://github.com/enisdenjo/graphql-ws/blob/master/website/src/pages/get-started.mdx?plain=1#L195-L196
and reads as though the value returned from
query.next()
is thedata
element of the GraphQL response.But using the client
query.next()
with a GraphQL server returns a higher level object:The tests added by #486 also show that the value returned is the higher-level object: https://github.com/enisdenjo/graphql-ws/blob/master/src/__tests__/client.ts#L2355-L2361
Maybe I'm missing something, I'm not a javascript/typescript expert so maybe there's some magic going on with the test harness and
expect
, but I found the mismatch confusing with what value was expected to be returned.