Sinon doesn't seem to be stubbing a method from an imported file. Is it to do with exporting consts?
I see "Received ORIGINAL MESSAGE" in the console.log.
Main.js
import * as otherActions from 'filters/actions/Other.actions';
describe('filter actions', () => {
it('should log STUBBED MESSAGE', () => {
sinon.stub(otherActions, 'logMessage').callsFake(m => console.log('STUBBED Message'));
const compiled = otherActions.doSomethingAndLogMessage(5, 5);
compiled(message => console.log(`RECEIVED ${message}`), () => {});
});
});
Other.actions.js
export const logMessage = () => console.log("ORIGINAL MESSAGE");
export const doSomethingAndLogMessage = (categoryId, size) => (dispatch, getState) => {
dispatch(logMessage());
};