title: How to test functions inside angularjs services using jasmine-karma
body: <p>I am new to karma-jasmine testing.I have written one service which makes http get call to api and returns data object.</p>
  
  <pre><code>app.service('service_name',['$http',function($http){
      this.getData=function(urlPath){
          var Data = $http.get(path).success(function(data){
                  var getData = data;
                  console.log("getData success");
                  return getData;
              }).error(function(response){
                  var getData = response;
                  console.log("getData error");
                  return getData;
              });
  
          console.log(Data);
          return Data;
      };
  }]);
  </code></pre>
  
  <p>From controller I am passing url to this service function and getting data using <code>.then()</code> callback;</p>
  
  <pre><code>service_name.getData(url).then(function(data){
      console.log('expected data: ', data);
  });
  </code></pre>