Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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 .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
[libs]

[lints]
sketchy-null-bool=off
sketchy-null-bool=error
sketchy-null-string=error
sketchy-null-number=error
sketchy-null-mixed=off
sketchy-null-mixed=error
sketchy-number=error
untyped-type-import=error
nonstrict-import=error
Expand Down
28 changes: 28 additions & 0 deletions src/__tests__/http-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,34 @@ function urlString(urlParams?: ?{ [param: string]: mixed, ... }) {
});
});

it('Allows async resolvers', async () => {
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
foo: {
type: GraphQLString,
resolve: () => Promise.resolve('bar'),
},
},
}),
});
const app = server();

get(app, urlString(), graphqlHTTP({ schema }));

const response = await request(app).get(
urlString({
query: '{ foo }',
}),
);

expect(response.status).to.equal(200);
expect(JSON.parse(response.text)).to.deep.equal({
data: { foo: 'bar' },
});
});

it('Allows passing in a context', async () => {
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
Expand Down
Loading