我很想在karma和jasmine中为下面的代码写一个测试用例。所以请为beloe代码提供有效的测试用例。提前谢谢。
angular.module('formlyApp').factory('commonService', ['$http', '$q', 'SessionService', 'Constants', '$stateParams', commonService]);
function commonService($http, $q, SessionService, Constants, $stateParams) {
var commonService = {};
var configData = {};
//Getter to access page object in config file
commonService.getfunctionLinkObject = function(functionLink) {
var returnObj = {};
if(functionLink && functionLink != '') {
angular.forEach(commonService.getConfigData(), function(value, key) {
if(value.pageName == commonService.getPageName() && value.panelName == functionLink) {
returnObj = value;
}
});
}
return returnObj;
};
}
})();