Open raghavi92 opened 3 months ago
With auth.useAuth.mockResolvedValue('test');
you mock useAuth like it would be a string ("test"), but it is a function...
@pamapa Actually I tried this first but it didnt work:
jest.mock('react-oidc-context', () => {
const orig = jest.requireActual('react-oidc-context');
return {
__esModule: true,
default: jest.fn(),
useAuth: jest.fn,
...orig,
};
});
I might have pasted my last snippet out of a lot of failed attempts...
I went through this already existing issue: https://github.com/authts/react-oidc-context/issues/372
But my mock for the
useAuth
function is simply not working. Can someone help please ?I added the below code segment to my test file:
I'm getting the error
TypeError: auth.useAuth.mockResolvedValue is not a function
. I have a nextjs project with typescript enabled.