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

Function spies #145

Open
paulshryock opened this issue Aug 27, 2024 · 0 comments
Open

Function spies #145

paulshryock opened this issue Aug 27, 2024 · 0 comments

Comments

@paulshryock
Copy link
Contributor

paulshryock commented Aug 27, 2024

Is there a way to create a function spy with Brain Monkey?

Given this function:

myFunction() {
  myOtherFunction();
}

Instead of this 'mock' expectation:

it('should call my other function', function() {
  Functions\expect('myOtherFunction')->once();
  myFunction();
});

I would like to write this 'spy' expectation:

it('should have called my other function', function() {
  Functions\spy('myOtherFunction');
  myFunction();
  Functions\expect('myOtherFunction')->shouldHaveBeenCalled()->once();
});
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

1 participant