I\'m testing a React/Reflux application using Jest. I have the following function in a store:
onLoad: function() {
c
I have found jest mock instance function It's here
eg:
import expect from 'expect';
jest.mock('../libs/utils/Master');
import Master from '../libs/utils/Master';
Master.mockImplementation(() => {
return {
returnOne: jest.fn().mockReturnValueOnce(1)
}
})
describe('test Master', function() {
it('test search', function() {
let master = new Master();
expect(master.returnOne()).toEqual(1);
});
});