@@ -510,68 +510,6 @@ test('error key setting in array', () => {
510510 }
511511} ) ;
512512
513- test ( `Object values of a Map are not frozen anymore #1119` , ( ) => {
514- {
515- enableMapSet ( ) ;
516-
517- interface Fruit {
518- key : string ;
519- name : string ;
520- }
521-
522- const fruits : Fruit [ ] = [
523- { key : 'apple1' , name : 'Red Delicious' } ,
524- { key : 'apple2' , name : 'Gala' } ,
525- ] ;
526-
527- let products = new Map < string , Fruit > ( ) ;
528-
529- function setFruitMap ( fruits : Fruit [ ] ) : void {
530- products = produce ( products , ( draft ) => {
531- draft . clear ( ) ;
532- fruits . forEach ( ( fruit ) => draft . set ( fruit . key , fruit ) ) ;
533- } ) ;
534- }
535-
536- setFruitMap ( fruits ) ;
537-
538- const product = products . get ( 'apple1' ) ;
539- // ! it should be frozen
540- expect ( Object . isFrozen ( product ) ) . not . toBeTruthy ( ) ;
541- }
542- {
543- interface Fruit {
544- key : string ;
545- name : string ;
546- }
547-
548- const fruits : Fruit [ ] = [
549- { key : 'apple1' , name : 'Red Delicious' } ,
550- { key : 'apple2' , name : 'Gala' } ,
551- ] ;
552-
553- let products : Immutable < Map < string , Fruit > > = new Map ( ) ;
554-
555- function setFruitMap ( fruits : Fruit [ ] ) : void {
556- products = create (
557- products ,
558- ( draft ) => {
559- draft . clear ( ) ;
560- fruits . forEach ( ( fruit ) => draft . set ( fruit . key , fruit ) ) ;
561- } ,
562- {
563- enableAutoFreeze : true ,
564- }
565- ) ;
566- }
567-
568- setFruitMap ( fruits ) ;
569-
570- const product = products . get ( 'apple1' ) ;
571- expect ( Object . isFrozen ( product ) ) . toBeTruthy ( ) ;
572- }
573- } ) ;
574-
575513test ( '#47 Avoid deep copies' , ( ) => {
576514 {
577515 const obj = { k : 42 } ;
0 commit comments