@@ -80,6 +80,7 @@ describe('Mock property', function () {
8080 enableCache : true ,
8181 delay : 10
8282 } ;
83+ var home = process . env . HOME ;
8384
8485 afterEach ( muk . restore ) ;
8586
@@ -91,21 +92,25 @@ describe('Mock property', function () {
9192 it ( 'Property are new after mocked' , function ( ) {
9293 muk ( config , 'enableCache' , false ) ;
9394 muk ( config , 'delay' , 0 ) ;
95+ muk ( process . env , 'HOME' , '/mockhome' ) ;
9496
9597 assert . equal ( config . enableCache , false , 'enableCache is false' ) ;
9698 assert . equal ( config . delay , 0 , 'delay is 0' ) ;
99+ assert . equal ( process . env . HOME , '/mockhome' , 'process.env.HOME is /mockhome' ) ;
97100 } ) ;
98101
99102 it ( 'Should have original properties after muk.restore()' , function ( ) {
100103 muk ( config , 'enableCache' , false ) ;
101104 muk ( config , 'enableCache' , false ) ;
102105 muk ( config , 'delay' , 0 ) ;
106+ muk ( process . env , 'HOME' , '/mockhome' ) ;
103107 muk ( config , 'notExistProp' , 'value' ) ;
104108 muk ( process . env , 'notExistProp' , 0 ) ;
105109 muk . restore ( ) ;
106110
107111 assert . equal ( config . enableCache , true , 'enableCache is true' ) ;
108112 assert . equal ( config . delay , 10 , 'delay is 10' ) ;
113+ assert . equal ( process . env . HOME , home , 'process.env.HOME is ' + home ) ;
109114 assert ( ! hasOwnProperty ( config , 'notExistProp' ) , 'notExistProp is deleted' ) ;
110115 assert ( ! hasOwnProperty ( process . env , 'notExistProp' ) , 'notExistProp is deleted' ) ;
111116 } ) ;
0 commit comments