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
Post a Comment