I have angular modules:
var app = angular.module("SearchUI",[]);
I have a configService service that supports a set of configuration parameters:
app.provider("configService",function(){
I conducted jasmine block tests in configService fineL
describe('configService',function(){ var configService,$httpBackend; beforeEach(module('SearchUI')); beforeEach(inject(function(_configService_,$injector){ configService = _configService_; $httpBackend = $injector.get("$httpBackend"); })); it('should have default values for configService', function(){ expect(configService.getDefaultSearch()).toEqual(['abstract','title','keyword','keywordplus' ]); });
all tests pass normally.
however, I don't understand how to maintain this injection in another service:
In my application:
app.service("SearchService",function($http,$log,configService,$q){
my specification:
describe('SearchService',function(){ var searchService,configService; beforeEach(module('SearchUI')); beforeEach(inject(function(_configService_,_SearchService_){ configService = _configService_; searchService = _SearchService_; })); it('SearchService should return results', function(){ var waiting = searchService.SimpleSearch("card","wos",0);
the specification does not work because the following is required in the simplesearch function:
search_params = configService.getDefaultSearch();
My question is: how do I insert the required service into the ANOTHER service?