我正在努力为下面的代码编写测试用例(Karma + Jasmine)

时间:2017-03-02 05:15:37

标签: angularjs karma-jasmine

我很想在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;
        		};
        
        }
        })();

0 个答案:

没有答案