I recently started using jasmine to record a junit test case for one of our applications. I am stuck at this point on how to call the callBack function of the spied function.
setProfile :function(userProfile,callback){ var user; var subjectInfo; iService.searchForAccess(subjectInfo , queryCalback); function queryCalback(err, userProfile) { if(err){ callback(true,errorMessage) }else{ callback(false,null) } } }
Now, in my specification, I want to make fun of the iService.searchForAccess call of the real world and want to call nocallThrough for searchForAccess. but my queryCalback function needs to be called to cover full use.
In my specification, I tried to explicitly call the queryCalback function using
spyOn(iService,'searchForAccess'); iService.searchForAccess.mostRecentCall.args[1](error, userProfile);
but iService.searchForAccess.mostRecentCall returns {}, an empty object.
kindly help !!!!!!!!!!
Punith Relations
source share