javascript - jest mock for multiple cases -


// file.js  import fun1 ‘package1/src’  if (fun1) {     return “hello world”; } else {     return “good bye” } 

i want cover branch file.js in test file

// file-test.js  describe(‘test fun1’, () => {     it(’should return hello world when fun1 true’, async() => {         expect blabla     });     it(’should return bye when fun1 false’, async() => {         expect blabla     }); }); 

in case, how jest mock fun1 in file-test? thank much!


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -