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

Possible to chain when using onFirstCall, onSecondCall #24

Open
newmanw opened this issue Aug 25, 2017 · 2 comments
Open

Possible to chain when using onFirstCall, onSecondCall #24

newmanw opened this issue Aug 25, 2017 · 2 comments

Comments

@newmanw
Copy link

newmanw commented Aug 25, 2017

Cannot seem to get this to work:

    sandbox.mock(Model)
      .expects('find')
      .twice()
      .onFirstCall()
      .yields(null, [])
      .onSecondCall()
      .chain('populate')
      .chain('exec')
      .yields(null, []);
@gaguirre
Copy link
Collaborator

gaguirre commented Oct 2, 2017

This is not supported but I think is possible to test using two different expectations right?

    sandbox.mock(Model)
      .expects('find')
      .chain('exec')
      .yields(null, [])

    sandbox.mock(Model)
      .expects('find')
      .chain('populate')
      .chain('exec')
      .yields(null, []);

@newmanw
Copy link
Author

newmanw commented Apr 18, 2018

I don't think that is supported, I get the following error:

 TypeError: Attempted to wrap find which is already wrapped

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