I'm trying to create tests for a provider, but I can't seem to configure it in the test. Here's my provider with which I'm configuring a service with a url when it gets instantiated:
angular.module('PRXHttpData', [])
.provider('HttpData', function(){
var url;
this.setUrl = function(_url_){
url = _url_;
};
this.$get = function(){
return new HttpDataService(url);
}
});
function HttpDataService(url){
this.url = url;
}
Here's my test setup:
beforeEach(function () {
angular.mock.module('PRXHttpData');
});
var HttpDataProvider;
beforeEach(inject(function (_HttpData_) {
HttpDataProvider = _HttpData_;
}));
I tried doing:
beforeEach(function () {
angular.mock.module('PRXHttpData').config(function(HttpData){
HttpData.setUrl('test/url');
});
});
But it gives me the error "Cannot read property 'config' of undefined"
How can I configure my provider in my test?