How to mock/spy an imported function in Angular unit testing
In your spec file import the helper this way: import * as helper from ‘./helper’; And in your it() you can spy on the helper object and return the requested value: spyOn(helper, ‘doSomething’).and.returnValue({});