ts-mockito icon indicating copy to clipboard operation
ts-mockito copied to clipboard

Instanceof-Operator: (instance(mock(MyClass)) instanceof MyClass) is false.

Open Hirschfuchs opened this issue 2 years ago • 1 comments
trafficstars

As mentioned in https://github.com/NagRock/ts-mockito/issues/204 it is not possible to use the „instanceof“ operator on an instance of a mock. There are workarounds but the native functionality would be nice.

Example: const mockedInstanceOfMyClass = instance(mock(MyClass)) console.log(mockedInstanceOfMyClass instanceof MyClass) // false, should be true

Hirschfuchs avatar May 16 '23 14:05 Hirschfuchs

Can you provide with a code sample of usage? I want to provide the solution but it depends on the ergonomics of the usage.

roypeled avatar Jul 14 '24 15:07 roypeled