File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import {
1010 GraphQLInterfaceType ,
1111 GraphQLObjectType ,
1212 GraphQLString ,
13+ GraphQLInputObjectType ,
14+ GraphQLDirective ,
1315} from '../' ;
1416
1517import { describe , it } from 'mocha' ;
@@ -26,6 +28,25 @@ const ImplementingType = new GraphQLObjectType({
2628 fields : { fieldName : { type : GraphQLString , resolve : ( ) => '' } } ,
2729} ) ;
2830
31+ const DirectiveInputType = new GraphQLInputObjectType ( {
32+ name : 'DirInput' ,
33+ fields : {
34+ field : {
35+ type : GraphQLString ,
36+ } ,
37+ } ,
38+ } ) ;
39+
40+ const Directive = new GraphQLDirective ( {
41+ name : 'dir' ,
42+ locations : [ 'OBJECT' ] ,
43+ args : {
44+ arg : {
45+ type : DirectiveInputType ,
46+ } ,
47+ } ,
48+ } ) ;
49+
2950const Schema = new GraphQLSchema ( {
3051 query : new GraphQLObjectType ( {
3152 name : 'Query' ,
@@ -38,6 +59,7 @@ const Schema = new GraphQLSchema({
3859 } ,
3960 } ,
4061 } ) ,
62+ directives : [ Directive ] ,
4163} ) ;
4264
4365describe ( 'Type System: Schema' , ( ) => {
@@ -53,4 +75,10 @@ describe('Type System: Schema', () => {
5375 ) ;
5476 } ) ;
5577 } ) ;
78+
79+ describe ( 'Type Map' , ( ) => {
80+ it ( 'includes input types only used in directives' , ( ) => {
81+ expect ( Schema . getTypeMap ( ) ) . to . include . key ( 'DirInput' ) ;
82+ } ) ;
83+ } ) ;
5684} ) ;
You can’t perform that action at this time.
0 commit comments