@@ -80,6 +80,7 @@ describe('Mock property', function () {
80
80
enableCache : true ,
81
81
delay : 10
82
82
} ;
83
+ var home = process . env . HOME ;
83
84
84
85
afterEach ( muk . restore ) ;
85
86
@@ -91,21 +92,25 @@ describe('Mock property', function () {
91
92
it ( 'Property are new after mocked' , function ( ) {
92
93
muk ( config , 'enableCache' , false ) ;
93
94
muk ( config , 'delay' , 0 ) ;
95
+ muk ( process . env , 'HOME' , '/mockhome' ) ;
94
96
95
97
assert . equal ( config . enableCache , false , 'enableCache is false' ) ;
96
98
assert . equal ( config . delay , 0 , 'delay is 0' ) ;
99
+ assert . equal ( process . env . HOME , '/mockhome' , 'process.env.HOME is /mockhome' ) ;
97
100
} ) ;
98
101
99
102
it ( 'Should have original properties after muk.restore()' , function ( ) {
100
103
muk ( config , 'enableCache' , false ) ;
101
104
muk ( config , 'enableCache' , false ) ;
102
105
muk ( config , 'delay' , 0 ) ;
106
+ muk ( process . env , 'HOME' , '/mockhome' ) ;
103
107
muk ( config , 'notExistProp' , 'value' ) ;
104
108
muk ( process . env , 'notExistProp' , 0 ) ;
105
109
muk . restore ( ) ;
106
110
107
111
assert . equal ( config . enableCache , true , 'enableCache is true' ) ;
108
112
assert . equal ( config . delay , 10 , 'delay is 10' ) ;
113
+ assert . equal ( process . env . HOME , home , 'process.env.HOME is ' + home ) ;
109
114
assert ( ! hasOwnProperty ( config , 'notExistProp' ) , 'notExistProp is deleted' ) ;
110
115
assert ( ! hasOwnProperty ( process . env , 'notExistProp' ) , 'notExistProp is deleted' ) ;
111
116
} ) ;
0 commit comments