jsmockito
jsmockito copied to clipboard
Can I do iterator-style stubbing with jsMockito?
Hi,
I have just come across your library. And I have just a quick question to ask.
Can I do consecutive stubbing callback with JsMockito?
I have this code that I would like to test. It's a recursive call until the count is equal to 5. I have been scouting all over the Internet until I come across your library and I'm a big fan of Mockito.
var callback = function(result) {
if(result.count < 5) {
msg_id = result.msg_id;
MovieService.getMovies(msg_id, result.count).get(callback, error);
}
if(result.movies.length !== 0) {
setDataToDisplay(result);
}
if(result.count === 5) {
$scope.loading = false;
}
}
MovieService.getMovies(msg_id, 0).get(callback, error);
I'm unsure what it is you're trying to stub? Have you written a sample test yet?