@@ -15,6 +15,7 @@ import {
1515 assertDirective ,
1616 GraphQLSkipDirective ,
1717 GraphQLIncludeDirective ,
18+ GraphQLDeferDirective ,
1819 GraphQLDeprecatedDirective ,
1920} from '../../type/directives' ;
2021import {
@@ -182,12 +183,13 @@ describe('Schema Builder', () => {
182183 expect ( cycleSDL ( sdl , { commentDescriptions : true } ) ) . to . equal ( sdl ) ;
183184 } ) ;
184185
185- it ( 'Maintains @skip & @include ' , ( ) => {
186+ it ( 'Maintains @skip, @include & @defer ' , ( ) => {
186187 const schema = buildSchema ( 'type Query' ) ;
187188
188- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
189+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
189190 expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
190191 expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
192+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
191193 expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
192194 GraphQLDeprecatedDirective ,
193195 ) ;
@@ -197,27 +199,30 @@ describe('Schema Builder', () => {
197199 const schema = buildSchema ( `
198200 directive @skip on FIELD
199201 directive @include on FIELD
202+ directive @defer on FIELD
200203 directive @deprecated on FIELD_DEFINITION
201204 ` ) ;
202205
203- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
206+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
204207 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( GraphQLSkipDirective ) ;
205208 expect ( schema . getDirective ( 'include' ) ) . to . not . equal (
206209 GraphQLIncludeDirective ,
207210 ) ;
211+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( GraphQLDeferDirective ) ;
208212 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal (
209213 GraphQLDeprecatedDirective ,
210214 ) ;
211215 } ) ;
212216
213- it ( 'Adding directives maintains @skip & @include ' , ( ) => {
217+ it ( 'Adding directives maintains @skip, @include & @defer ' , ( ) => {
214218 const schema = buildSchema ( `
215219 directive @foo(arg: Int) on FIELD
216220 ` ) ;
217221
218- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
222+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
219223 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( undefined ) ;
220224 expect ( schema . getDirective ( 'include' ) ) . to . not . equal ( undefined ) ;
225+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( undefined ) ;
221226 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
222227 } ) ;
223228
0 commit comments