jest mock callback call code example
Example 1: jest mock mockname
test("mockName", () => {
const mockFn = jest.fn().mockName("mockedFunction");
mockFn(); // comment me
expect(mockFn).toHaveBeenCalled();
});
Example 2: test function that call a function javascrip
var bar = require('./bar');
var Foo = module.exports = function () {
this.bar();
this.barModule();
};
Foo.prototype.bar = function () {};
Foo.prototype.barModule = bar; // setting here as barModule