Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/execution/__tests__/stream-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,7 @@ describe('Execute: stream directive', () => {

const document = parse(`
query {
friendList @stream(initialCount: 1, label:"stream-label") {
friendList @stream(label:"stream-label") {
...NameFragment @defer(label: "DeferName") @defer(label: "DeferName")
id
}
Expand Down Expand Up @@ -2146,12 +2146,9 @@ describe('Execute: stream directive', () => {
const result1 = executeResult.initialResult;
expectJSON(result1).toDeepEqual({
data: {
friendList: [{ id: '1' }],
friendList: [],
},
pending: [
{ id: '0', path: ['friendList', 0], label: 'DeferName' },
{ id: '1', path: ['friendList'], label: 'stream-label' },
],
pending: [{ id: '0', path: ['friendList'], label: 'stream-label' }],
hasNext: true,
});

Expand All @@ -2160,13 +2157,18 @@ describe('Execute: stream directive', () => {
const result2 = await result2Promise;
expectJSON(result2).toDeepEqual({
value: {
pending: [{ id: '1', path: ['friendList', 0], label: 'DeferName' }],
incremental: [
{
data: { name: 'Luke' },
items: [{ id: '1' }],
id: '0',
},
{
data: { name: 'Luke' },
id: '1',
},
],
completed: [{ id: '0' }],
completed: [{ id: '1' }],
hasNext: true,
},
done: false,
Expand All @@ -2181,7 +2183,7 @@ describe('Execute: stream directive', () => {
incremental: [
{
items: [{ id: '2' }],
id: '1',
id: '0',
},
],
hasNext: true,
Expand All @@ -2191,7 +2193,7 @@ describe('Execute: stream directive', () => {
const result4 = await iterator.next();
expectJSON(result4).toDeepEqual({
value: {
completed: [{ id: '1' }],
completed: [{ id: '0' }],
hasNext: true,
},
done: false,
Expand Down
2 changes: 1 addition & 1 deletion src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,7 @@ async function getNextAsyncStreamItemResult(
getNextAsyncStreamItemResult(
streamItemQueue,
streamPath,
index,
index + 1,
asyncIterator,
exeContext,
fieldGroup,
Expand Down