@@ -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 {
@@ -182,12 +183,13 @@ describe('Schema Builder', () => {
182
183
expect ( cycleSDL ( sdl , { commentDescriptions : true } ) ) . to . equal ( sdl ) ;
183
184
} ) ;
184
185
185
- it ( 'Maintains @skip & @include ' , ( ) => {
186
+ it ( 'Maintains @skip, @include & @defer ' , ( ) => {
186
187
const schema = buildSchema ( 'type Query' ) ;
187
188
188
- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
189
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
189
190
expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
190
191
expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
192
+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
191
193
expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
192
194
GraphQLDeprecatedDirective ,
193
195
) ;
@@ -197,27 +199,30 @@ describe('Schema Builder', () => {
197
199
const schema = buildSchema ( `
198
200
directive @skip on FIELD
199
201
directive @include on FIELD
202
+ directive @defer on FIELD
200
203
directive @deprecated on FIELD_DEFINITION
201
204
` ) ;
202
205
203
- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 3 ) ;
206
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
204
207
expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( GraphQLSkipDirective ) ;
205
208
expect ( schema . getDirective ( 'include' ) ) . to . not . equal (
206
209
GraphQLIncludeDirective ,
207
210
) ;
211
+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( GraphQLDeferDirective ) ;
208
212
expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal (
209
213
GraphQLDeprecatedDirective ,
210
214
) ;
211
215
} ) ;
212
216
213
- it ( 'Adding directives maintains @skip & @include ' , ( ) => {
217
+ it ( 'Adding directives maintains @skip, @include & @defer ' , ( ) => {
214
218
const schema = buildSchema ( `
215
219
directive @foo(arg: Int) on FIELD
216
220
` ) ;
217
221
218
- expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 4 ) ;
222
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
219
223
expect ( schema . getDirective ( 'skip' ) ) . to . not . equal ( undefined ) ;
220
224
expect ( schema . getDirective ( 'include' ) ) . to . not . equal ( undefined ) ;
225
+ expect ( schema . getDirective ( 'defer' ) ) . to . not . equal ( undefined ) ;
221
226
expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
222
227
} ) ;
223
228
0 commit comments