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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -