In Jasmine, you can spyOn(object, 'function'). I am trying to spyOn a provider, which is used as "provider()". How to spyOn it?
The provider looks like this:
providers.provider('telecom', function() {
this.$get = function() {
return function() {
return 'something';
}
}
}
In controller, it would be used like this:
controllers.controller('ctrl', function(telecom) {
var isp = telecom();
});
For object.method(), we can spyOn(object, 'method'). What about provider()?
I've googled and can not find anything helpful. I tried spyOn(provider), but I got error saying "undefined() method does not exist".
I even try to mock the provider, but didn't success. (http://www.sitepoint.com/mocking-dependencies-angularjs-tests/)