File tree 2 files changed +20
-0
lines changed 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import {
16
16
GraphQLSkipDirective ,
17
17
GraphQLIncludeDirective ,
18
18
GraphQLDeprecatedDirective ,
19
+ GraphQLStreamDirective ,
20
+ GraphQLDeferDirective ,
19
21
} from '../../type/directives' ;
20
22
import {
21
23
GraphQLID ,
@@ -247,6 +249,22 @@ describe('Schema Builder', () => {
247
249
expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
248
250
} ) ;
249
251
252
+ it ( 'Adds @stream and @defer when experimental flags are passed to schema' , ( ) => {
253
+ const schema = buildSchema ( 'type Query' , {
254
+ experimentalStream : true ,
255
+ experimentalDefer : true ,
256
+ } ) ;
257
+
258
+ expect ( schema . getDirectives ( ) ) . to . have . lengthOf ( 5 ) ;
259
+ expect ( schema . getDirective ( 'stream' ) ) . to . equal ( GraphQLStreamDirective ) ;
260
+ expect ( schema . getDirective ( 'defer' ) ) . to . equal ( GraphQLDeferDirective ) ;
261
+ expect ( schema . getDirective ( 'skip' ) ) . to . equal ( GraphQLSkipDirective ) ;
262
+ expect ( schema . getDirective ( 'include' ) ) . to . equal ( GraphQLIncludeDirective ) ;
263
+ expect ( schema . getDirective ( 'deprecated' ) ) . to . equal (
264
+ GraphQLDeprecatedDirective ,
265
+ ) ;
266
+ } ) ;
267
+
250
268
it ( 'Type modifiers' , ( ) => {
251
269
const sdl = dedent `
252
270
type Query {
Original file line number Diff line number Diff line change @@ -154,5 +154,7 @@ export function buildSchema(
154
154
commentDescriptions : ( options && options . commentDescriptions ) || false ,
155
155
assumeValidSDL : ( options && options . assumeValidSDL ) || false ,
156
156
assumeValid : ( options && options . assumeValid ) || false ,
157
+ experimentalDefer : ( options && options . experimentalDefer ) || false ,
158
+ experimentalStream : ( options && options . experimentalStream ) || false ,
157
159
} ) ;
158
160
}
You can’t perform that action at this time.
0 commit comments