Skip to content
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

add failing test #3

Closed
Closed
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
56 changes: 56 additions & 0 deletions src/execution/__tests__/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,62 @@ describe('Execute: defer directive', () => {
]);
});

it('Separately emits defer fragments with different labels with varying subfields with superimposed masked defer', async () => {
const document = parse(`
query HeroNameQuery {
... @defer(label: "DeferID") {
hero {
id
friends { name }
... @defer {
friends { name }
}
}
}
... @defer(label: "DeferName") {
hero {
name
}
}
}
`);
const result = await complete(document);
expectJSON(result).toDeepEqual([
{
data: {},
pending: [
{ id: '0', path: [], label: 'DeferID' },
{ id: '1', path: [], label: 'DeferName' },
],
hasNext: true,
},
{
pending: [{ id: '2', path: ['hero'] }],
incremental: [
{
data: { hero: {} },
id: '0',
},
{
data: {
id: '1',
friends: [{ name: 'Han' }, { name: 'Leia' }, { name: 'C-3PO' }],
},
id: '0',
subPath: ['hero'],
},
{
data: { name: 'Luke' },
id: '1',
subPath: ['hero'],
},
],
completed: [{ id: '0' }, { id: '1' }],
hasNext: false,
},
]);
});

it('Separately emits defer fragments with different labels with varying subfields that return promises', async () => {
const document = parse(`
query HeroNameQuery {
Expand Down
Loading