injected-loader
Webpack dependency injection for testing
Usage
export default function() { return false; };
import MyGreatMethod from './my_great_method.js';
export default function(input) {
return MyGreatMethod(input);
}
import GreatMethodProxyInjector from 'injected!./great_method_proxy';
var MockGreatMethod = jasmine.createSpy().and.returnValue(true);
let GreatMethodProxy = GreatMethodProxyInjector({
'./my_great_method.js': MockGreatMethod
});
describe('GreatMethodProxy', function(){
it('calls our mocked method', function(){
expect(GreatMethodProxy()).toBe(true);
expect(MockGreatMethod).toHaveBeenCalled();
});
});