@@ -15,6 +15,7 @@ import {
15
15
assertDirective ,
16
16
GraphQLSkipDirective ,
17
17
GraphQLIncludeDirective ,
18
+ GraphQLDeferDirective ,
18
19
GraphQLDeprecatedDirective ,
19
20
} from '../../type/directives' ;
20
21
import {
@@ -208,12 +209,13 @@ describe('Schema Builder', () => {
208
209
expect ( cycleSDL ( sdl , { commentDescriptions : true } ) ) . to . equal ( sdl ) ;
209
210
} ) ;
210
211
211
- it ( 'Maintains @skip & @include ' , ( ) => {
212
+ it ( 'Maintains @skip, @include & @defer ' , ( ) => {
212
213
const schema = buildSchema ( 'type Query' ) ;
213
214
214
- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
215
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
215
216
expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
216
217
expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
218
+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
217
219
expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
218
220
GraphQLDeprecatedDirective ,
219
221
) ;
@@ -223,27 +225,30 @@ describe('Schema Builder', () => {
223
225
const schema = buildSchema ( `
224
226
directive @skip on FIELD
225
227
directive @include on FIELD
228
+ directive @defer on FIELD
226
229
directive @deprecated on FIELD_DEFINITION
227
230
` ) ;
228
231
229
- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
232
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
230
233
expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( GraphQLSkipDirective ) ;
231
234
expect ( schema . getDirective ( 'include' ) ) . to . not . equal (
232
235
GraphQLIncludeDirective ,
233
236
) ;
237
+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( GraphQLDeferDirective ) ;
234
238
expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal (
235
239
GraphQLDeprecatedDirective ,
236
240
) ;
237
241
} ) ;
238
242
239
- it ( 'Adding directives maintains @skip & @include ' , ( ) => {
243
+ it ( 'Adding directives maintains @skip, @include & @defer ' , ( ) => {
240
244
const schema = buildSchema ( `
241
245
directive @foo(arg: Int) on FIELD
242
246
` ) ;
243
247
244
- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
248
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
245
249
expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( undefined ) ;
246
250
expect ( schema . getDirective ( 'include' ) ) . to . not . equal ( undefined ) ;
251
+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( undefined ) ;
247
252
expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
248
253
} ) ;
249
254
0 commit comments