cleishm / jsmockito

Javascript mocking framework inspired by the awesome mockito
http://jsmockito.org
Other
106 stars 19 forks source link

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

Closed mllrjb closed 11 years ago

mllrjb commented 11 years ago

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.

cleishm commented 11 years ago

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

cleishm commented 11 years ago

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