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

Why we need "instance()"? #87

Closed
ilbonte opened this issue Feb 20, 2018 · 4 comments
Closed

Why we need "instance()"? #87

ilbonte opened this issue Feb 20, 2018 · 4 comments

Comments

@ilbonte
Copy link

ilbonte commented Feb 20, 2018

Hi, I'm trying to understand why we need a separate function (instance()) to get an instance of a mocked class, since in the original (Java) version of mockito, mock() returns an instantiated object.

There is some technical limitation in Typesctipt?

@NagRock
Copy link
Owner

NagRock commented Feb 27, 2018

Hi @ilbonte yes this is technical limitation. I can't find any way to get rid of instance function.
It would be great to have more similar api to original Java version.

@NagRock NagRock closed this as completed Feb 27, 2018
@joshden
Copy link

joshden commented Apr 4, 2018

Thanks, @NagRock. Coming from Mockito, I was confused on this as well when first looking at the Readme. Might be good to add to the Readme that this is a technical limitation.

@killdash9
Copy link

It was confusing to me as well -- A mention in the documentation would be nice.

@NagRock
Copy link
Owner

NagRock commented Aug 28, 2018

@killdash9 you're right. Currently I'm trying to get some solution to avoid using instance but this causes same problems as in Java mockito. Where using when() function causes real instance function call and forces using doReturn('something').when... in some situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants