0

I have a factory which has a method which does a $http call . it takes two obj params and 4 callbacks . How do i unit test the method and it's callbacks using Karma -Jasmine ? all the other answers on stack aren't helping me with callbacks .

app.factory('somefactory', ['$http','$rootScope','dependency',
function($http, $rootScope,dependency){

var factory = {
//two obj params and 4 callback parmas           
  method:function(obj1,obj2,succCallbk,failureCallbk,errCallbk,completeCallbk){
        $http({
          method: obj.method,
          url: url,
          data: requestData
        }).success(function(data, status, headers, config){
             if(someCondition){
            _succCallbk(data, status);
            }
             if(someCondition){
            _completeCallbk(data, status);
            }
          })
          .error(function(err){
           if(someCondition){
             _errCallbk()}
            })
           }
          };
 return factory;
})
3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.