File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ import {
26
26
GraphQLList ,
27
27
GraphQLNonNull ,
28
28
} from '../../' ;
29
+ import { GraphQLDirective } from '../../type/directives' ;
30
+ import { DirectiveLocation } from '../../language/directiveLocation' ;
29
31
30
32
function printForTest ( schema ) {
31
33
return printSchema ( schema ) ;
@@ -564,6 +566,33 @@ describe('Type System Printer', () => {
564
566
` ) ;
565
567
} ) ;
566
568
569
+ it ( 'Prints custom directives' , ( ) => {
570
+ const Query = new GraphQLObjectType ( {
571
+ name : 'Query' ,
572
+ fields : {
573
+ field : { type : GraphQLString } ,
574
+ } ,
575
+ } ) ;
576
+
577
+ const CustomDirective = new GraphQLDirective ( {
578
+ name : 'customDirective' ,
579
+ locations : [ DirectiveLocation . FIELD ] ,
580
+ } ) ;
581
+
582
+ const Schema = new GraphQLSchema ( {
583
+ query : Query ,
584
+ directives : [ CustomDirective ] ,
585
+ } ) ;
586
+ const output = printForTest ( Schema ) ;
587
+ expect ( output ) . to . equal ( dedent `
588
+ directive @customDirective on FIELD
589
+
590
+ type Query {
591
+ field: String
592
+ }
593
+ ` ) ;
594
+ } ) ;
595
+
567
596
it ( 'Print Introspection Schema' , ( ) => {
568
597
const Root = new GraphQLObjectType ( {
569
598
name : 'Root' ,
You can’t perform that action at this time.
0 commit comments