Skip to content
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

Mobx testing #1888

Closed
mishk0 opened this issue Jan 31, 2019 · 5 comments · Fixed by #2014
Closed

Mobx testing #1888

mishk0 opened this issue Jan 31, 2019 · 5 comments · Fixed by #2014

Comments

@mishk0
Copy link

mishk0 commented Jan 31, 2019

Since v5.9.0 computed properties became not configurable. That's probably why Sinon.js throws an error, while stubbing a getter: TypeError: Cannot redefine property.

Are there any ways to stub/spy a getter, best practices?

@ItamarShDev
Copy link
Member

@mweststrate
Copy link
Member

mweststrate commented Feb 6, 2019

@mishk0

class X {

   @computed get nonStubable() {
     return this.stubablle()
   }

   /* private */ stubable() {
      // this one is stubable, but the indirection won't loose any of the semantic benefits of `nonStubable` 
   }
}

@ItamarShDev
Copy link
Member

@mishk0 Any updates on this issue?

@mishk0
Copy link
Author

mishk0 commented Feb 8, 2019

@mweststrate thanks!

@lock
Copy link

lock bot commented Jul 21, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants