@@ -152,23 +152,30 @@ describe('<ResponsiveProvider />', () => {
152152 expect ( listenersRemovedAfterUnmount ) . toBe ( listenersAdded ) ;
153153 } ) ;
154154
155- test ( 'should not call console.log in the test environment' , ( ) => {
156- window . resizeTo ( 1024 , 768 ) ;
155+ test . each (
156+ [ 'production' , 'test' ] ,
157+ 'should not call console.log in the % environment' ,
158+ ( env ) => {
159+ process . env . NODE_ENV = env ;
160+ window . resizeTo ( 1024 , 768 ) ;
157161
158- render (
159- < ResponsiveProvider { ...props } >
160- < div > Test</ div >
161- </ ResponsiveProvider >
162- ) ;
162+ render (
163+ < ResponsiveProvider { ...props } >
164+ < div > Test</ div >
165+ </ ResponsiveProvider >
166+ ) ;
163167
164- expect ( global . console . group ) . not . toHaveBeenCalled ( ) ;
165- expect ( global . console . log ) . not . toHaveBeenCalled ( ) ;
166- expect ( global . console . groupEnd ) . not . toHaveBeenCalled ( ) ;
167- } ) ;
168+ expect ( global . console . group ) . not . toHaveBeenCalled ( ) ;
169+ expect ( global . console . log ) . not . toHaveBeenCalled ( ) ;
170+ expect ( global . console . groupEnd ) . not . toHaveBeenCalled ( ) ;
171+
172+ // Clean the global changes
173+ process . env . NODE_ENV = 'test' ;
174+ }
175+ ) ;
168176
169- test ( 'should call console.log only outside the test environment' , ( ) => {
170- // Set this as prod environment
171- process . env . NODE_ENV = 'dev' ;
177+ test ( 'should call console.log only for development environment' , ( ) => {
178+ process . env . NODE_ENV = 'development' ;
172179 window . resizeTo ( 1024 , 768 ) ;
173180
174181 const { unmount } = render (
0 commit comments