Comments (6)
Reset is a great idea, but in this case, it actually takes less bookkeeping (thus simpler) to configure setting vars directly via an input flag. See if https://github.com/uber/mockolo/releases/tag/1.3.1 resolves your scenario. If needed we can revisit a reset function in the future.
from mockolo.
A method to reset the mock sounds reasonable and even better than manually zeroing the counts.
from mockolo.
We can make it configurable. How soon would you need this? Also feel free to push a PR if possible. Our ETA is within the next couple of weeks.
from mockolo.
@elsh not super critical for us right now. We just quickly changed the code that was making use of this.
I would like to understand the reasoning why making it private in the first place is desirable.
from mockolo.
I think private(set)
might be quite useful to ensure the internal mock state is not accidentally tempered by the tests. If the mock needs to be reused or brought to the initial state, a resetMock()
(or similar) method could be an alternative to ensure all of the properties are getting into the initial state.
from mockolo.
@elsh Thanks a lot for the quick help here! Really appreciated
from mockolo.
Related Issues (20)
- Incorrect mock generated for composed protocol HOT 2
- support for async properties? HOT 2
- @available attribute on function mocked incorrectly HOT 3
- Consider method that has `some` parameter.
- Support Actor Protocol HOT 6
- Xcode14.2 Fatal error: The operation couldn’t be completed. (SwiftSyntaxParser.ParserError error 1.) HOT 1
- Contributors with admin access
- [bug] Duplicated underlying var declarations generated for protocol mocks with init requirements HOT 2
- Allow output to stdout
- SwiftSyntax 508.0.0 HOT 1
- [BUG] Mocking functions with `for` parameter + include-history
- [BUG] Does not mock protocol requirements from other module HOT 2
- import collection is overly broad
- [Bug] Protocol that inherits from protocols in two different modules with same function name does not produce unique handlers HOT 2
- Mock of class with computed properties causes compile error.
- Add build tool plugin HOT 2
- Uncompilable mock generated for NSObjectProtocol / @objc protocols
- Async functions are unsafe in generated mocks, and can crash if used from multiple threads simultaneously HOT 2
- Skip creation of empty files if there are no mocks to generate HOT 2
- Suppress Sendable protocol warnings HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockolo.