Skip to content

Commit

Permalink
consolidate payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed May 18, 2023
1 parent 165623a commit 5f98356
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 220 deletions.
84 changes: 20 additions & 64 deletions src/execution/__tests__/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,6 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [{ path: ['hero'], label: 'DeferID' }],
incremental: [
{
data: {
Expand All @@ -689,20 +688,17 @@ describe('Execute: defer directive', () => {
},
path: [],
},
],
completed: [{ path: [], label: 'DeferName' }],
hasNext: true,
},
{
incremental: [
{
data: {
id: '1',
},
path: ['hero'],
},
],
completed: [{ path: ['hero'], label: 'DeferID' }],
completed: [
{ path: [], label: 'DeferName' },
{ path: ['hero'], label: 'DeferID' },
],
hasNext: false,
},
]);
Expand Down Expand Up @@ -870,7 +866,6 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
incremental: [
{
data: {
Expand All @@ -880,20 +875,17 @@ describe('Execute: defer directive', () => {
},
path: ['hero'],
},
],
completed: [{ path: ['hero'] }],
hasNext: true,
},
{
incremental: [
{
data: {
bar: 'bar',
},
path: ['hero', 'nestedObject', 'deeperObject'],
},
],
completed: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
completed: [
{ path: ['hero'] },
{ path: ['hero', 'nestedObject', 'deeperObject'] },
],
hasNext: false,
},
]);
Expand Down Expand Up @@ -948,35 +940,25 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject'] }],
incremental: [
{
data: { bar: 'bar' },
path: ['hero', 'nestedObject', 'deeperObject'],
},
],
completed: [{ path: ['hero'] }],
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
incremental: [
{
data: { baz: 'baz' },
path: ['hero', 'nestedObject', 'deeperObject'],
},
],
hasNext: true,
completed: [{ path: ['hero', 'nestedObject'] }],
},
{
incremental: [
{
data: { bak: 'bak' },
path: ['hero', 'nestedObject', 'deeperObject'],
},
],
completed: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
completed: [
{ path: ['hero'] },
{ path: ['hero', 'nestedObject'] },
{ path: ['hero', 'nestedObject', 'deeperObject'] },
],
hasNext: false,
},
]);
Expand Down Expand Up @@ -1023,31 +1005,25 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
incremental: [
{
data: {
foo: 'foo',
},
path: ['hero', 'nestedObject', 'deeperObject'],
},
],
completed: [
{ path: ['hero', 'nestedObject', 'deeperObject'] },
{ path: ['hero'] },
],
hasNext: true,
},
{
incremental: [
{
data: {
bar: 'bar',
},
path: ['hero', 'nestedObject', 'deeperObject'],
},
],
completed: [{ path: ['hero', 'nestedObject', 'deeperObject'] }],
completed: [
{ path: ['hero', 'nestedObject', 'deeperObject'] },
{ path: ['hero'] },
{ path: ['hero', 'nestedObject', 'deeperObject'] },
],
hasNext: false,
},
]);
Expand Down Expand Up @@ -1843,27 +1819,17 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
],
incremental: [
{
data: { name: 'slow', friends: [{}, {}, {}] },
path: ['hero'],
},
],
completed: [{ 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] },
],
completed: [
{ path: ['hero'] },
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
Expand Down Expand Up @@ -1900,11 +1866,6 @@ describe('Execute: defer directive', () => {
hasNext: true,
},
{
pending: [
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
],
incremental: [
{
data: {
Expand All @@ -1913,17 +1874,12 @@ describe('Execute: defer directive', () => {
},
path: ['hero'],
},
],
completed: [{ 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] },
],
completed: [
{ path: ['hero'] },
{ path: ['hero', 'friends', 0] },
{ path: ['hero', 'friends', 1] },
{ path: ['hero', 'friends', 2] },
Expand Down
Loading

0 comments on commit 5f98356

Please sign in to comment.