Skip to content

Commit

Permalink
Add failing test for directive's input types in getTypeMap()
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogu committed Jan 2, 2018
1 parent fd4a69c commit 2616ced
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/type/__tests__/schema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLString,
GraphQLInputObjectType,
GraphQLDirective,
} from '../';

import { describe, it } from 'mocha';
Expand All @@ -26,6 +28,25 @@ const ImplementingType = new GraphQLObjectType({
fields: { fieldName: { type: GraphQLString, resolve: () => '' } },
});

const DirectiveInputType = new GraphQLInputObjectType({
name: 'DirInput',
fields: {
field: {
type: GraphQLString,
},
},
});

const Directive = new GraphQLDirective({
name: 'dir',
locations: ['OBJECT'],
args: {
arg: {
type: DirectiveInputType,
},
},
});

const Schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
Expand All @@ -38,6 +59,7 @@ const Schema = new GraphQLSchema({
},
},
}),
directives: [Directive],
});

describe('Type System: Schema', () => {
Expand All @@ -53,4 +75,10 @@ describe('Type System: Schema', () => {
);
});
});

describe('Type Map', () => {
it('includes input types only used in directives', () => {
expect(Schema.getTypeMap()).to.include.key('DirInput');
});
});
});

0 comments on commit 2616ced

Please sign in to comment.