-
Notifications
You must be signed in to change notification settings - Fork 93
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
(instance(mock(MyClass)) instanceof MyClass) is false. #204
Comments
I also encountered a problem checking |
I'am hacked it's via Symbol.hasInstance and duck typing in my test:
|
@prKassad const mockedInstanceOfMyClass = instance(mock(MyClass))
console.log(mockedInstanceOfMyClass instanceof MyClass) // false
Object.setPrototypeOf(mockedInstanceOfMyClass, MyClass.prototype)
console.log(mockedInstanceOfMyClass instanceof MyClass) // true |
This one should take more attention for getting |
Nice! This is right |
how about:
|
The mock instance from ts-mockito does not return true with
instanceof
.Thus, when I test my code like following with the mock instance (Proxy), I cannot test as I intended.
I can manually set the prototype of parent class to my mock instance with
Object.setPrototypeOf()
and pass the test of code withinstanceof
without modification, but it's natural that the mock instance of a class is the instance of the class by default.The text was updated successfully, but these errors were encountered: