Hi Gregg,
Thanks for help. I'm using $httpBackend to mock service. I am using AngulaJS. There an issue while calling function inside promise resolve. I have seen async tutorial still it not helped. calling function is also another promise it has. please let me know how to use $hhtpBackend flush(); with timeout. If there is one resolve http then it work fine resole inside if i given more function it throws error.
this is first function
it('getDateRangeData return Data obj', inject(function($q, $rootScope, $http) {
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
})
myService.gettest1().then(function() {
console.log("success2");
});
$httpBackend.flush();
}));
it works fine if in controllercode is like this
function init(){
myService.gettest1().then(function() {
console.log("i'm working");
$scope.Text = "Welcome"
// loadOtherFunction()
});
}
init();
function loadOtherFunction() {
myService.gettest2().then(function() {
some code
});
}
If i uncomment loadOtherFunction it throws error and if I consle scope.Text in jasmine it shows scope.Text undefined.Can I know is it fall in async calling tried with timeout in $httpBackend .flush but still not working. Can you please help me on it.