-
Notifications
You must be signed in to change notification settings - Fork 176
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
Comparing invocation history of two different mocks #331
Comments
I'm not sure that letting the user have access to the invocation history is a good idea. I know they can already do it because the functions you mentioned are part of the public API so they're accessible, but as far as I know it's not documented anywhere so it's not really part of the "official" API. My approach would be to give the user the minimal API surface needed to do what they want to do, so it would rather look like this: But maybe I'm wrong and we can safely make
Not that I'm aware of.
I haven't really looked at how invocation data are stored so I don't know. One issue that you may encounter is the one of dangling references (#274). With the standard Maybe you can ignore that issue. Maybe you can try a different approach by comparing the identity of referenced objects (that they have the same address) instead of their equality, but that would differ from how
Not that I'm aware of.
If it's not too complicated to implement I think it would be a good idea. By "too complicated" I'm mainly talking about compilation time, so if it requires dozen of templated templates of templates I'll be more cautious about merging that feature (I'll wait to see if other people want it merged), but I don't think it will be to complicated so it shouldn't be an issue.
You can submit a PR, the worst case scenario is that you get some feedback on your implementation, and then you'll always be able to create an "add-on" library anyway. |
Motivation
Imagine a situation where you are refactoring code which are supposed to calls mocked methods in some "similar" order with similar parameters.
I checked the library and this equality testing of invocation history is not documented. I imagine something like this pseudo code:
I am still unfamiliar with FakeIt and recently started contributing to a code base which uses it.
Questions
compareHistoriesDifferenceExplaination
?Mock
s of mocking the same class called by different classes?compareHistoriesDifferenceExplaination
?compareHistoriesDifferenceExplaination
under a less unwieldy name be an contribution the community appreciates?In my case "similar" means identical. But i could see an extension of this to cover mocked calls having equality relations, properties like idem-potency and information whether certain calls commute given certain arguments being interesting to pursue further given an use case.
The text was updated successfully, but these errors were encountered: