Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I do iterator-style stubbing with jsMockito? #24

Open
noppanit opened this issue Jul 31, 2013 · 1 comment
Open

Can I do iterator-style stubbing with jsMockito? #24

noppanit opened this issue Jul 31, 2013 · 1 comment

Comments

@noppanit
Copy link

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);
@cleishm
Copy link
Owner

cleishm commented Oct 16, 2013

I'm unsure what it is you're trying to stub? Have you written a sample test yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants