Skip to content

Commit 1e6794b

Browse files
committed
Remove unnecessary async code, part 2
Continuation of graphql#269
1 parent 5b42850 commit 1e6794b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/node/__tests__/plural.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
GraphQLObjectType,
88
GraphQLSchema,
99
GraphQLString,
10-
graphql,
10+
graphqlSync,
1111
} from 'graphql';
1212

1313
import { pluralIdentifyingRootField } from '../plural';
@@ -47,7 +47,7 @@ const schema = new GraphQLSchema({
4747
const context = { lang: 'en' };
4848

4949
describe('pluralIdentifyingRootField()', () => {
50-
it('allows fetching', async () => {
50+
it('allows fetching', () => {
5151
const query = `
5252
{
5353
usernames(usernames:[ "dschafer", "leebyron", "schrockn" ]) {
@@ -57,7 +57,7 @@ describe('pluralIdentifyingRootField()', () => {
5757
}
5858
`;
5959

60-
expect(await graphql(schema, query, null, context)).to.deep.equal({
60+
expect(graphqlSync(schema, query, null, context)).to.deep.equal({
6161
data: {
6262
usernames: [
6363
{
@@ -77,7 +77,7 @@ describe('pluralIdentifyingRootField()', () => {
7777
});
7878
});
7979

80-
it('correctly introspects', async () => {
80+
it('correctly introspects', () => {
8181
const query = `
8282
{
8383
__schema {
@@ -113,7 +113,7 @@ describe('pluralIdentifyingRootField()', () => {
113113
}
114114
`;
115115

116-
expect(await graphql(schema, query)).to.deep.equal({
116+
expect(graphqlSync(schema, query)).to.deep.equal({
117117
data: {
118118
__schema: {
119119
queryType: {

src/node/plural.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,24 @@ type PluralIdentifyingRootFieldConfig = {|
2424
export function pluralIdentifyingRootField(
2525
config: PluralIdentifyingRootFieldConfig,
2626
): GraphQLFieldConfig<mixed, mixed> {
27-
const inputArgs = {};
2827
let inputType = config.inputType;
2928
if (isNonNullType(inputType)) {
3029
inputType = inputType.ofType;
3130
}
32-
inputArgs[config.argName] = {
33-
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(inputType))),
34-
};
3531
return {
3632
description: config.description,
3733
type: new GraphQLList(config.outputType),
38-
args: inputArgs,
34+
args: {
35+
[config.argName]: {
36+
type: new GraphQLNonNull(
37+
new GraphQLList(new GraphQLNonNull(inputType)),
38+
),
39+
},
40+
},
3941
resolve(_obj, args, context, info) {
4042
const inputs = args[config.argName];
41-
return Promise.all(
42-
inputs.map((input) =>
43-
Promise.resolve(config.resolveSingleInput(input, context, info)),
44-
),
43+
return inputs.map((input) =>
44+
config.resolveSingleInput(input, context, info),
4545
);
4646
},
4747
};

0 commit comments

Comments
 (0)