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

go - serving up pdfs using golang -

python - Best design pattern for collection of objects -

r - Using `bbmle:mle2` with vector parameters (already works using `optim`) -