@@ -307,8 +307,8 @@ describe("Definition Tests", () => {
307307 } ) ;
308308
309309 const state = new State ( ) ;
310- assert . ok ( state . entity1 instanceof Entity ) ;
311- assert . ok ( state . entity2 instanceof Entity ) ;
310+ assert . ok ( state . entity1 === undefined ) ;
311+ assert . ok ( state . entity2 === undefined ) ;
312312
313313 assert . ok ( state . map instanceof MapSchema ) ;
314314 assert . strictEqual ( state . map . size , 0 ) ;
@@ -320,8 +320,6 @@ describe("Definition Tests", () => {
320320 assert . strictEqual ( state . array2 . length , 0 ) ;
321321
322322 const state2 = new State ( ) ;
323- assert . ok ( state . entity1 !== state2 . entity1 ) ;
324- assert . ok ( state . entity2 !== state2 . entity2 ) ;
325323 assert . ok ( state . map !== state2 . map ) ;
326324 assert . ok ( state . array1 !== state2 . array1 ) ;
327325 assert . ok ( state . array2 !== state2 . array2 ) ;
@@ -656,6 +654,27 @@ describe("Definition Tests", () => {
656654
657655 } ) ;
658656
657+ it ( "should not auto-initialize Schema instances" , ( ) => {
658+ const Base = schema ( {
659+ value : 'string' ,
660+ initialize ( value : { something : string } ) {
661+ this . value = value . something ;
662+ } ,
663+ } ) ;
664+
665+ const Child = schema ( {
666+ world : 'string' ,
667+ random : Base ,
668+ initialize ( world : string ) {
669+ this . world = world ;
670+ } ,
671+ } ) ;
672+
673+ assert . doesNotThrow ( ( ) => {
674+ new Child ( 'hello' ) ;
675+ } ) ;
676+ } ) ;
677+
659678 } ) ;
660679
661680} ) ;
0 commit comments