Giter Site home page Giter Site logo

Is private(set) really desirable? about mockolo HOT 6 CLOSED

uber avatar uber commented on May 17, 2024
Is private(set) really desirable?

from mockolo.

Comments (6)

elsh avatar elsh commented on May 17, 2024 2

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.

FranzBusch avatar FranzBusch commented on May 17, 2024 1

A method to reset the mock sounds reasonable and even better than manually zeroing the counts.

from mockolo.

elsh avatar elsh commented on May 17, 2024

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.

FranzBusch avatar FranzBusch commented on May 17, 2024

@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.

marciniwanicki avatar marciniwanicki commented on May 17, 2024

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.

FranzBusch avatar FranzBusch commented on May 17, 2024

@elsh Thanks a lot for the quick help here! Really appreciated

from mockolo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.