I want to replace actual service with mock service while writing Unit test cases for controller. What I'm trying to achieve is using .and.callFake function of jasmine but its not working as expected.
See jsfiddle
spyOn(mockTestService,'getData').and.callFake(function() {
console.log("log from mock service");
deferred.resolve({data : "mockRes"});
return deferred.promise;
});
I want to return mock data for one of my service call and verify success call back function of controller.
Aucun commentaire:
Enregistrer un commentaire