Issues mocking Auth0 `getProfile is not a function`
I'm trying to mock my Auth0 dependency, however, when I try to mock the class's method with a stub I always get an error stating that the method I want to mock is not a function. See below.
const authenticationClient = mock(AuthenticationClient)
const mockedAuthenticationClient = instance(authenticationClient)
when(authenticationClient.getProfile('efwwef')).thenResolve({
ewe: 'wef'
})
Creating a TypeScript class in the same file with the getProfile method works perfectly fine. I'm not sure what's going on!
Same problem for me mocking the ManagementClient, I think it's because auth0 add properties to the prototype using Object.defineProperty, where the getter of that property is binding the function when the getter is invoked.
I'm not a ts-mockito contributor, but I don't think this is a problem that can be solved here.
Hello, We have the same problem mocking Injector on Angular 8.
My problem is that the mocked method is abstract.
Maybe it's the same for you. https://github.com/NagRock/ts-mockito/issues/112