Skip to content

Commit

Permalink
incremental(stream): revert test logic
Browse files Browse the repository at this point in the history
Test logic was inadvertently altered in graphql#4026.

Tests still pass, just fixing logic.
  • Loading branch information
yaacovCR committed Jun 3, 2024
1 parent 06bb157 commit 266fd70
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/execution/__tests__/stream-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,9 @@ describe('Execute: stream directive', () => {
hasNext: true,
});

const result2 = await iterator.next();
const result2Promise = iterator.next();
resolveIterableCompletion(null);
const result2 = await result2Promise;
expectJSON(result2).toDeepEqual({
value: {
pending: [{ id: '2', path: ['friendList', 1], label: 'DeferName' }],
Expand All @@ -1960,7 +1962,7 @@ describe('Execute: stream directive', () => {
});

const result3Promise = iterator.next();
resolveIterableCompletion(null);
resolveSlowField('Han');
const result3 = await result3Promise;
expectJSON(result3).toDeepEqual({
value: {
Expand All @@ -1969,9 +1971,7 @@ describe('Execute: stream directive', () => {
},
done: false,
});
const result4Promise = iterator.next();
resolveSlowField('Han');
const result4 = await result4Promise;
const result4 = await iterator.next();
expectJSON(result4).toDeepEqual({
value: {
incremental: [
Expand Down Expand Up @@ -2062,19 +2062,8 @@ describe('Execute: stream directive', () => {
done: false,
});

const result3Promise = iterator.next();
resolveIterableCompletion(null);
const result3 = await result3Promise;
const result3 = await iterator.next();
expectJSON(result3).toDeepEqual({
value: {
completed: [{ id: '1' }],
hasNext: true,
},
done: false,
});

const result4 = await iterator.next();
expectJSON(result4).toDeepEqual({
value: {
incremental: [
{
Expand All @@ -2083,6 +2072,17 @@ describe('Execute: stream directive', () => {
},
],
completed: [{ id: '2' }],
hasNext: true,
},
done: false,
});

const result4Promise = iterator.next();
resolveIterableCompletion(null);
const result4 = await result4Promise;
expectJSON(result4).toDeepEqual({
value: {
completed: [{ id: '1' }],
hasNext: false,
},
done: false,
Expand Down

0 comments on commit 266fd70

Please sign in to comment.