Skip to content

introduce new Publisher for incremental delivery #3786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
10 changes: 0 additions & 10 deletions src/execution/__tests__/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,6 @@ describe('Execute: defer directive', () => {
data: { slowField: 'slow', friends: [{}, {}, {}] },
path: ['hero'],
},
],
hasNext: true,
},
{
incremental: [
{ data: { name: 'Han' }, path: ['hero', 'friends', 0] },
{ data: { name: 'Leia' }, path: ['hero', 'friends', 1] },
{ data: { name: 'C-3PO' }, path: ['hero', 'friends', 2] },
Expand Down Expand Up @@ -653,11 +648,6 @@ describe('Execute: defer directive', () => {
},
path: ['hero'],
},
],
hasNext: true,
},
{
incremental: [
{ data: { name: 'Han' }, path: ['hero', 'friends', 0] },
{ data: { name: 'Leia' }, path: ['hero', 'friends', 1] },
{ data: { name: 'C-3PO' }, path: ['hero', 'friends', 2] },
Expand Down
97 changes: 21 additions & 76 deletions src/execution/__tests__/stream-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,10 @@ describe('Execute: stream directive', () => {
hasNext: true,
},
{
incremental: [{ items: ['banana'], path: ['scalarList', 1] }],
hasNext: true,
},
{
incremental: [{ items: ['coconut'], path: ['scalarList', 2] }],
incremental: [
{ items: ['banana'], path: ['scalarList', 1] },
{ items: ['coconut'], path: ['scalarList', 2] },
],
hasNext: false,
},
]);
Expand All @@ -173,15 +172,11 @@ describe('Execute: stream directive', () => {
hasNext: true,
},
{
incremental: [{ items: ['apple'], path: ['scalarList', 0] }],
hasNext: true,
},
{
incremental: [{ items: ['banana'], path: ['scalarList', 1] }],
hasNext: true,
},
{
incremental: [{ items: ['coconut'], path: ['scalarList', 2] }],
incremental: [
{ items: ['apple'], path: ['scalarList', 0] },
{ items: ['banana'], path: ['scalarList', 1] },
{ items: ['coconut'], path: ['scalarList', 2] },
],
hasNext: false,
},
]);
Expand Down Expand Up @@ -230,11 +225,6 @@ describe('Execute: stream directive', () => {
path: ['scalarList', 1],
label: 'scalar-stream',
},
],
hasNext: true,
},
{
incremental: [
{
items: ['coconut'],
path: ['scalarList', 2],
Expand Down Expand Up @@ -296,11 +286,6 @@ describe('Execute: stream directive', () => {
items: [['banana', 'banana', 'banana']],
path: ['scalarListList', 1],
},
],
hasNext: true,
},
{
incremental: [
{
items: [['coconut', 'coconut', 'coconut']],
path: ['scalarListList', 2],
Expand Down Expand Up @@ -379,20 +364,10 @@ describe('Execute: stream directive', () => {
items: [{ name: 'Luke', id: '1' }],
path: ['friendList', 0],
},
],
hasNext: true,
},
{
incremental: [
{
items: [{ name: 'Han', id: '2' }],
path: ['friendList', 1],
},
],
hasNext: true,
},
{
incremental: [
{
items: [{ name: 'Leia', id: '3' }],
path: ['friendList', 2],
Expand Down Expand Up @@ -531,11 +506,6 @@ describe('Execute: stream directive', () => {
},
],
},
],
hasNext: true,
},
{
incremental: [
{
items: [{ name: 'Leia', id: '3' }],
path: ['friendList', 2],
Expand Down Expand Up @@ -707,7 +677,12 @@ describe('Execute: stream directive', () => {
hasNext: true,
},
},
{ done: false, value: { hasNext: false } },
{
done: false,
value: {
hasNext: false,
},
},
{ done: true, value: undefined },
]);
});
Expand Down Expand Up @@ -935,11 +910,6 @@ describe('Execute: stream directive', () => {
},
],
},
],
hasNext: true,
},
{
incremental: [
{
items: [{ nonNullName: 'Han' }],
path: ['friendList', 2],
Expand Down Expand Up @@ -984,11 +954,6 @@ describe('Execute: stream directive', () => {
},
],
},
],
hasNext: true,
},
{
incremental: [
{
items: [{ nonNullName: 'Han' }],
path: ['friendList', 2],
Expand Down Expand Up @@ -1117,11 +1082,6 @@ describe('Execute: stream directive', () => {
},
],
},
],
hasNext: true,
},
{
incremental: [
{
items: [{ nonNullName: 'Han' }],
path: ['friendList', 2],
Expand Down Expand Up @@ -1407,9 +1367,6 @@ describe('Execute: stream directive', () => {
],
},
],
hasNext: true,
},
{
hasNext: false,
},
]);
Expand Down Expand Up @@ -1556,9 +1513,6 @@ describe('Execute: stream directive', () => {
path: ['friendList', 2],
},
],
hasNext: true,
},
{
hasNext: false,
},
]);
Expand Down Expand Up @@ -1612,15 +1566,6 @@ describe('Execute: stream directive', () => {
data: { scalarField: 'slow', nestedFriendList: [] },
path: ['nestedObject'],
},
],
hasNext: true,
},
done: false,
});
const result3 = await iterator.next();
expectJSON(result3).toDeepEqual({
value: {
incremental: [
{
items: [{ name: 'Luke' }],
path: ['nestedObject', 'nestedFriendList', 0],
Expand All @@ -1630,8 +1575,8 @@ describe('Execute: stream directive', () => {
},
done: false,
});
const result4 = await iterator.next();
expectJSON(result4).toDeepEqual({
const result3 = await iterator.next();
expectJSON(result3).toDeepEqual({
value: {
incremental: [
{
Expand All @@ -1643,13 +1588,13 @@ describe('Execute: stream directive', () => {
},
done: false,
});
const result5 = await iterator.next();
expectJSON(result5).toDeepEqual({
const result4 = await iterator.next();
expectJSON(result4).toDeepEqual({
value: { hasNext: false },
done: false,
});
const result6 = await iterator.next();
expectJSON(result6).toDeepEqual({
const result5 = await iterator.next();
expectJSON(result5).toDeepEqual({
value: undefined,
done: true,
});
Expand Down
Loading