cleishm / jsmockito

Javascript mocking framework inspired by the awesome mockito

Home Page:http://jsmockito.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verifier for "unknown" / "at least" number of invocations

mllrjb opened this issue · comments

It doesn't look like there is a way to verify that there were 'at least' or an 'unknown' number of interactions with a mock.

For example, I want to verify that foo.bar() got called at least once, but don't care when else it got called. Having to verify the actual number of times can lead to fragile code.

I run into this frequently, when I'm doing a check/set of a value between two objects, and testing the logic that handles the check/set. I want to verify the check and set got called, but don't care how many times the check ran.

Hi!

That sounds like a good thing to have, and should be fairly simple to add. Would you like to submit a pull request?

Cheers,
Chris

Actually - this was a good way to remind myself of the codebase. So I just added atLeast & atMost verifiers.