Skip to content

Commit f0c3215

Browse files
committed
Move AsyncIteratable tests in to separate block
1 parent 42c83f3 commit f0c3215

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/execution/__tests__/lists-test.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,35 @@ describe('Execute: Accepts any iterable as list value', () => {
6262
],
6363
});
6464
});
65+
});
66+
67+
describe('Execute: Accepts async iterables as list value', () => {
68+
function complete(rootValue: mixed) {
69+
return execute({
70+
schema: buildSchema('type Query { listField: [String] }'),
71+
document: parse('{ listField }'),
72+
rootValue,
73+
});
74+
}
6575

6676
it('Accepts an AsyncGenerator function as a List value', async () => {
67-
async function* yieldAsyncItems() {
77+
async function* listField() {
6878
yield await 'two';
6979
yield await 4;
7080
yield await false;
7181
}
72-
const listField = yieldAsyncItems();
7382

7483
expect(await complete({ listField })).to.deep.equal({
7584
data: { listField: ['two', '4', 'false'] },
7685
});
7786
});
7887

7988
it('Handles an AsyncGenerator function that throws', async () => {
80-
async function* yieldAsyncItemsError() {
89+
async function* listField() {
8190
yield await 'two';
8291
yield await 4;
8392
throw new Error('bad');
8493
}
85-
const listField = yieldAsyncItemsError();
8694

8795
expect(await complete({ listField })).to.deep.equal({
8896
data: { listField: ['two', '4', null] },

0 commit comments

Comments
 (0)