Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/execution/__tests__/lists-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ describe('Execute: Accepts any iterable as list value', () => {
});

it('Accepts function arguments as a List value', () => {
function getArgs(...args: Array<string>) {
return args;
function getArgs(..._args: Array<string>) {
return arguments;
}
const listField = getArgs('one', 'two');

Expand Down
17 changes: 17 additions & 0 deletions src/utilities/__tests__/astFromValue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,23 @@ describe('astFromValue', () => {
{ kind: 'EnumValue', value: 'GOODBYE' },
],
});

function* listGenerator() {
yield 1;
yield 2;
yield 3;
}

expect(
astFromValue(listGenerator(), new GraphQLList(GraphQLInt)),
).to.deep.equal({
kind: 'ListValue',
values: [
{ kind: 'IntValue', value: '1' },
{ kind: 'IntValue', value: '2' },
{ kind: 'IntValue', value: '3' },
],
});
});

it('converts list singletons', () => {
Expand Down
11 changes: 11 additions & 0 deletions src/utilities/__tests__/coerceInputValue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,17 @@ describe('coerceInputValue', () => {
expectValue(result).to.deep.equal([1, 2, 3]);
});

it('returns no error for a valid iterable input', () => {
function* listGenerator() {
yield 1;
yield 2;
yield 3;
}

const result = coerceValue(listGenerator(), TestList);
expectValue(result).to.deep.equal([1, 2, 3]);
});

it('returns an error for an invalid input', () => {
const result = coerceValue([1, 'b', true, 4], TestList);
expectErrors(result).to.deep.equal([
Expand Down