@@ -20,6 +20,7 @@ import {
2020 GraphQLIncludeDirective ,
2121 GraphQLDeprecatedDirective ,
2222 GraphQLSpecifiedByDirective ,
23+ GraphQLDeferDirective ,
2324} from '../../type/directives' ;
2425import {
2526 GraphQLID ,
@@ -221,12 +222,13 @@ describe('Schema Builder', () => {
221222 expect ( cycleSDL ( sdl ) ) . to . equal ( sdl ) ;
222223 } ) ;
223224
224- it ( 'Maintains @include, @skip & @specifiedBy ' , ( ) => {
225+ it ( 'Maintains specified directives ' , ( ) => {
225226 const schema = buildSchema ( 'type Query' ) ;
226227
227- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
228+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
228229 expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
229230 expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
231+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
230232 expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
231233 GraphQLDeprecatedDirective ,
232234 ) ;
@@ -241,9 +243,10 @@ describe('Schema Builder', () => {
241243 directive @include on FIELD
242244 directive @deprecated on FIELD_DEFINITION
243245 directive @specifiedBy on FIELD_DEFINITION
246+ directive @defer on FRAGMENT_SPREAD
244247 ` ) ;
245248
246- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
249+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
247250 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( GraphQLSkipDirective ) ;
248251 expect ( schema . getDirective ( 'include' ) ) . to . not . equal (
249252 GraphQLIncludeDirective ,
@@ -254,16 +257,18 @@ describe('Schema Builder', () => {
254257 expect ( schema . getDirective ( 'specifiedBy' ) ) . to . not . equal (
255258 GraphQLSpecifiedByDirective ,
256259 ) ;
260+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( GraphQLDeferDirective ) ;
257261 } ) ;
258262
259- it ( 'Adding directives maintains @include, @skip & @specifiedBy ' , ( ) => {
263+ it ( 'Adding directives maintains specified directives ' , ( ) => {
260264 const schema = buildSchema ( `
261265 directive @foo(arg: Int) on FIELD
262266 ` ) ;
263267
264- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
268+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 6 ) ;
265269 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( undefined ) ;
266270 expect ( schema . getDirective ( 'include' ) ) . to . not . equal ( undefined ) ;
271+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( undefined ) ;
267272 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
268273 expect ( schema . getDirective ( 'specifiedBy' ) ) . to . not . equal ( undefined ) ;
269274 } ) ;
0 commit comments