@@ -15,6 +15,7 @@ import {
1515 assertDirective ,
1616 GraphQLSkipDirective ,
1717 GraphQLIncludeDirective ,
18+ GraphQLDeferDirective ,
1819 GraphQLDeprecatedDirective ,
1920} from '../../type/directives' ;
2021import {
@@ -208,12 +209,13 @@ describe('Schema Builder', () => {
208209 expect ( cycleSDL ( sdl , { commentDescriptions : true } ) ) . to . equal ( sdl ) ;
209210 } ) ;
210211
211- it ( 'Maintains @skip & @include ' , ( ) => {
212+ it ( 'Maintains @skip, @include & @defer ' , ( ) => {
212213 const schema = buildSchema ( 'type Query' ) ;
213214
214- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
215+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
215216 expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
216217 expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
218+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
217219 expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
218220 GraphQLDeprecatedDirective ,
219221 ) ;
@@ -223,27 +225,30 @@ describe('Schema Builder', () => {
223225 const schema = buildSchema ( `
224226 directive @skip on FIELD
225227 directive @include on FIELD
228+ directive @defer on FIELD
226229 directive @deprecated on FIELD_DEFINITION
227230 ` ) ;
228231
229- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
232+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
230233 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( GraphQLSkipDirective ) ;
231234 expect ( schema . getDirective ( 'include' ) ) . to . not . equal (
232235 GraphQLIncludeDirective ,
233236 ) ;
237+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( GraphQLDeferDirective ) ;
234238 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal (
235239 GraphQLDeprecatedDirective ,
236240 ) ;
237241 } ) ;
238242
239- it ( 'Adding directives maintains @skip & @include ' , ( ) => {
243+ it ( 'Adding directives maintains @skip, @include & @defer ' , ( ) => {
240244 const schema = buildSchema ( `
241245 directive @foo(arg: Int) on FIELD
242246 ` ) ;
243247
244- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
248+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
245249 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( undefined ) ;
246250 expect ( schema . getDirective ( 'include' ) ) . to . not . equal ( undefined ) ;
251+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( undefined ) ;
247252 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
248253 } ) ;
249254
0 commit comments