diff --git a/src/node/__tests__/plural.js b/src/node/__tests__/plural.js index 1eaa4ac..50c62de 100644 --- a/src/node/__tests__/plural.js +++ b/src/node/__tests__/plural.js @@ -7,7 +7,7 @@ import { GraphQLObjectType, GraphQLSchema, GraphQLString, - graphql, + graphqlSync, } from 'graphql'; import { pluralIdentifyingRootField } from '../plural'; @@ -57,7 +57,7 @@ describe('pluralIdentifyingRootField()', () => { } `; - expect(await graphql(schema, query, null, context)).to.deep.equal({ + expect(graphqlSync(schema, query, null, context)).to.deep.equal({ data: { usernames: [ { @@ -113,7 +113,7 @@ describe('pluralIdentifyingRootField()', () => { } `; - expect(await graphql(schema, query)).to.deep.equal({ + expect(graphqlSync(schema, query)).to.deep.equal({ data: { __schema: { queryType: { diff --git a/src/node/plural.js b/src/node/plural.js index d342ff3..290f109 100644 --- a/src/node/plural.js +++ b/src/node/plural.js @@ -24,25 +24,21 @@ type PluralIdentifyingRootFieldConfig = {| export function pluralIdentifyingRootField( config: PluralIdentifyingRootFieldConfig, ): GraphQLFieldConfig { - const inputArgs = {}; let inputType = config.inputType; if (isNonNullType(inputType)) { inputType = inputType.ofType; } - inputArgs[config.argName] = { - type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(inputType))), - }; return { description: config.description, type: new GraphQLList(config.outputType), - args: inputArgs, + args: { + [config.argName]: { + type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(inputType))), + }, + }, resolve(_obj, args, context, info) { const inputs = args[config.argName]; - return Promise.all( - inputs.map((input) => - Promise.resolve(config.resolveSingleInput(input, context, info)), - ), - ); + return inputs.map((input) => config.resolveSingleInput(input, context, info)), }, }; }