@@ -19,6 +19,7 @@ import {
1919 GraphQLIncludeDirective ,
2020 GraphQLDeprecatedDirective ,
2121 GraphQLSpecifiedByDirective ,
22+ GraphQLDeferDirective ,
2223} from '../../type/directives' ;
2324import {
2425 GraphQLID ,
@@ -219,12 +220,13 @@ describe('Schema Builder', () => {
219220 expect ( cycleSDL ( sdl ) ) . to . equal ( sdl ) ;
220221 } ) ;
221222
222- it ( 'Maintains @include, @skip & @specifiedBy ' , ( ) => {
223+ it ( 'Maintains specified directives ' , ( ) => {
223224 const schema = buildSchema ( 'type Query' ) ;
224225
225- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
226+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
226227 expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
227228 expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
229+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
228230 expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
229231 GraphQLDeprecatedDirective ,
230232 ) ;
@@ -239,9 +241,10 @@ describe('Schema Builder', () => {
239241 directive @include on FIELD
240242 directive @deprecated on FIELD_DEFINITION
241243 directive @specifiedBy on FIELD_DEFINITION
244+ directive @defer on FRAGMENT_SPREAD
242245 ` ) ;
243246
244- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
247+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
245248 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( GraphQLSkipDirective ) ;
246249 expect ( schema . getDirective ( 'include' ) ) . to . not . equal (
247250 GraphQLIncludeDirective ,
@@ -252,16 +255,18 @@ describe('Schema Builder', () => {
252255 expect ( schema . getDirective ( 'specifiedBy' ) ) . to . not . equal (
253256 GraphQLSpecifiedByDirective ,
254257 ) ;
258+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( GraphQLDeferDirective ) ;
255259 } ) ;
256260
257- it ( 'Adding directives maintains @include, @skip & @specifiedBy ' , ( ) => {
261+ it ( 'Adding directives maintains specified directives ' , ( ) => {
258262 const schema = buildSchema ( `
259263 directive @foo(arg: Int) on FIELD
260264 ` ) ;
261265
262- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
266+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 6 ) ;
263267 expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( undefined ) ;
264268 expect ( schema . getDirective ( 'include' ) ) . to . not . equal ( undefined ) ;
269+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( undefined ) ;
265270 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
266271 expect ( schema . getDirective ( 'specifiedBy' ) ) . to . not . equal ( undefined ) ;
267272 } ) ;
0 commit comments