File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import {
1616 GraphQLSkipDirective ,
1717 GraphQLIncludeDirective ,
1818 GraphQLDeprecatedDirective ,
19+ GraphQLStreamDirective ,
20+ GraphQLDeferDirective ,
1921} from '../../type/directives' ;
2022import {
2123 GraphQLID ,
@@ -247,6 +249,22 @@ describe('Schema Builder', () => {
247249 expect ( schema . getDirective ( 'deprecated' ) ) . to . not . equal ( undefined ) ;
248250 } ) ;
249251
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+
250268 it ( 'Type modifiers' , ( ) => {
251269 const sdl = dedent `
252270 type Query {
Original file line number Diff line number Diff line change @@ -154,5 +154,7 @@ export function buildSchema(
154154 commentDescriptions : ( options && options . commentDescriptions ) || false ,
155155 assumeValidSDL : ( options && options . assumeValidSDL ) || false ,
156156 assumeValid : ( options && options . assumeValid ) || false ,
157+ experimentalDefer : ( options && options . experimentalDefer ) || false ,
158+ experimentalStream : ( options && options . experimentalStream ) || false ,
157159 } ) ;
158160}
You can’t perform that action at this time.
0 commit comments