Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that introspection results are always sync. #1120

Merged
merged 1 commit into from
Dec 6, 2017
Merged
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
42 changes: 21 additions & 21 deletions src/type/__tests__/introspection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { describe, it } from 'mocha';

import { missingFieldArgMessage } from '../../validation/rules/ProvidedNonNullArguments';
import {
graphql,
graphqlSync,
GraphQLSchema,
GraphQLObjectType,
GraphQLList,
Expand All @@ -22,7 +22,7 @@ import {
import { getIntrospectionQuery } from '../../utilities/introspectionQuery';

describe('Introspection', () => {
it('executes an introspection query', async () => {
it('executes an introspection query', () => {
const EmptySchema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'QueryRoot',
Expand All @@ -33,7 +33,7 @@ describe('Introspection', () => {
});

return expect(
await graphql(EmptySchema, getIntrospectionQuery()),
graphqlSync(EmptySchema, getIntrospectionQuery()),
).to.containSubset({
data: {
__schema: {
Expand Down Expand Up @@ -815,7 +815,7 @@ describe('Introspection', () => {
});
});

it('introspects on input object', async () => {
it('introspects on input object', () => {
const TestInputObject = new GraphQLInputObjectType({
name: 'TestInputObject',
fields: {
Expand Down Expand Up @@ -870,7 +870,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.containSubset({
return expect(graphqlSync(schema, request)).to.containSubset({
data: {
__schema: {
types: [
Expand Down Expand Up @@ -917,7 +917,7 @@ describe('Introspection', () => {
});
});

it('supports the __type root field', async () => {
it('supports the __type root field', () => {
const TestType = new GraphQLObjectType({
name: 'TestType',
fields: {
Expand All @@ -936,7 +936,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
__type: {
name: 'TestType',
Expand All @@ -945,7 +945,7 @@ describe('Introspection', () => {
});
});

it('identifies deprecated fields', async () => {
it('identifies deprecated fields', () => {
const TestType = new GraphQLObjectType({
name: 'TestType',
fields: {
Expand Down Expand Up @@ -973,7 +973,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
__type: {
name: 'TestType',
Expand All @@ -994,7 +994,7 @@ describe('Introspection', () => {
});
});

it('respects the includeDeprecated parameter for fields', async () => {
it('respects the includeDeprecated parameter for fields', () => {
const TestType = new GraphQLObjectType({
name: 'TestType',
fields: {
Expand Down Expand Up @@ -1026,7 +1026,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
__type: {
name: 'TestType',
Expand All @@ -1053,7 +1053,7 @@ describe('Introspection', () => {
});
});

it('identifies deprecated enum values', async () => {
it('identifies deprecated enum values', () => {
const TestEnum = new GraphQLEnumType({
name: 'TestEnum',
values: {
Expand Down Expand Up @@ -1086,7 +1086,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
__type: {
name: 'TestEnum',
Expand All @@ -1112,7 +1112,7 @@ describe('Introspection', () => {
});
});

it('respects the includeDeprecated parameter for enum values', async () => {
it('respects the includeDeprecated parameter for enum values', () => {
const TestEnum = new GraphQLEnumType({
name: 'TestEnum',
values: {
Expand Down Expand Up @@ -1149,7 +1149,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
__type: {
name: 'TestEnum',
Expand Down Expand Up @@ -1185,7 +1185,7 @@ describe('Introspection', () => {
});
});

it('fails as expected on the __type root field without an arg', async () => {
it('fails as expected on the __type root field without an arg', () => {
const TestType = new GraphQLObjectType({
name: 'TestType',
fields: {
Expand All @@ -1204,7 +1204,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.containSubset({
return expect(graphqlSync(schema, request)).to.containSubset({
errors: [
{
message: missingFieldArgMessage('__type', 'name', 'String!'),
Expand All @@ -1214,7 +1214,7 @@ describe('Introspection', () => {
});
});

it('exposes descriptions on types and fields', async () => {
it('exposes descriptions on types and fields', () => {
const QueryRoot = new GraphQLObjectType({
name: 'QueryRoot',
fields: {
Expand All @@ -1236,7 +1236,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
schemaType: {
name: '__Schema',
Expand Down Expand Up @@ -1277,7 +1277,7 @@ describe('Introspection', () => {
});
});

it('exposes descriptions on enums', async () => {
it('exposes descriptions on enums', () => {
const QueryRoot = new GraphQLObjectType({
name: 'QueryRoot',
fields: {
Expand All @@ -1299,7 +1299,7 @@ describe('Introspection', () => {
}
`;

return expect(await graphql(schema, request)).to.deep.equal({
return expect(graphqlSync(schema, request)).to.deep.equal({
data: {
typeKindType: {
name: '__TypeKind',
Expand Down