@@ -24,6 +24,7 @@ import {
24
24
} from '../introspection.js' ;
25
25
import { GraphQLBoolean , GraphQLInt , GraphQLString } from '../scalars.js' ;
26
26
import { GraphQLSchema } from '../schema.js' ;
27
+ import { validateSchema } from '../validate.js' ;
27
28
28
29
describe ( 'Type System: Schema' , ( ) => {
29
30
it ( 'Define sample schema' , ( ) => {
@@ -432,11 +433,21 @@ describe('Type System: Schema', () => {
432
433
describe ( 'Validity' , ( ) => {
433
434
describe ( 'when not assumed valid' , ( ) => {
434
435
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 ) ;
440
451
} ) ;
441
452
} ) ;
442
453
@@ -486,11 +497,11 @@ describe('Type System: Schema', () => {
486
497
487
498
describe ( 'when assumed valid' , ( ) => {
488
499
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 ( [ ] ) ;
494
505
} ) ;
495
506
} ) ;
496
507
} ) ;
0 commit comments