@@ -24,6 +24,7 @@ import {
2424} from '../introspection.js' ;
2525import { GraphQLBoolean , GraphQLInt , GraphQLString } from '../scalars.js' ;
2626import { GraphQLSchema } from '../schema.js' ;
27+ import { validateSchema } from '../validate.js' ;
2728
2829describe ( 'Type System: Schema' , ( ) => {
2930 it ( 'Define sample schema' , ( ) => {
@@ -432,11 +433,21 @@ describe('Type System: Schema', () => {
432433 describe ( 'Validity' , ( ) => {
433434 describe ( 'when not assumed valid' , ( ) => {
434435 it ( 'configures the schema to still needing validation' , ( ) => {
435- expect (
436- new GraphQLSchema ( {
437- assumeValid : false ,
438- } ) . __validationErrors ,
439- ) . to . equal ( undefined ) ;
436+ const schema = new GraphQLSchema ( {
437+ assumeValid : false ,
438+ } ) ;
439+ expect ( schema . assumeValid ) . to . equal ( false ) ;
440+ expect ( schema . __validationErrors ) . to . equal ( undefined ) ;
441+ } ) ;
442+
443+ it ( 'configures the schema to have required validation even once validated' , ( ) => {
444+ const schema = new GraphQLSchema ( {
445+ assumeValid : false ,
446+ } ) ;
447+ const validationErrors = validateSchema ( schema ) ;
448+ expect ( validationErrors . length ) . to . be . greaterThan ( 0 ) ;
449+ expect ( validationErrors ) . to . equal ( schema . __validationErrors ) ;
450+ expect ( schema . assumeValid ) . to . equal ( false ) ;
440451 } ) ;
441452 } ) ;
442453
@@ -486,11 +497,11 @@ describe('Type System: Schema', () => {
486497
487498 describe ( 'when assumed valid' , ( ) => {
488499 it ( 'configures the schema to have no errors' , ( ) => {
489- expect (
490- new GraphQLSchema ( {
491- assumeValid : true ,
492- } ) . __validationErrors ,
493- ) . to . deep . equal ( [ ] ) ;
500+ const schema = new GraphQLSchema ( {
501+ assumeValid : true ,
502+ } ) ;
503+ expect ( schema . assumeValid ) . to . equal ( true ) ;
504+ expect ( schema . __validationErrors ) . to . deep . equal ( [ ] ) ;
494505 } ) ;
495506 } ) ;
496507 } ) ;
0 commit comments