How to mock specific function in object using Jest?
I'm testing a React/Reflux application using Jest. I have the following function in a store: onLoad: function() { console.log("ORIGINAL LOAD"); // http request here } I'm trying to mock it out so that it just does what it needs to do without doing the actual network stuff: beforeEach(function() { // mock out onLoad so instead of making API call the store gets test data PostStore.onLoad = jest.genMockFunction().mockImplementation(function () { var p1 = new Post( "54da7df5119025513400000a", // id "Test Post", // title "Kji6ftLjUqhElgnqOBqMUKxYONpU7nK/cu6jTA==\n", // owner anonId "Test Course 1",