So I have this code stubbing a promise:
const getClientStub = sinon.stub(authenticationUtils, 'getClient').resolves(auth0ClientMock);
This code is question is this:
export const getClient = async (): Promise<Auth0Client> => {
return await createAuth0Client({
domain: window.globalConfiguration.auth0Domain,
client_id: window.globalConfiguration.auth0ClientId,
useRefreshTokens: true,
// this forces the user to re-authenticate when the user has logged out of the application
prompt: 'login',
// this need to match the audience that the server that we send jwt token to using for the token to be
// considered valid
audience: window.globalConfiguration.audience,
});
};
I know the mock it being called however the result of the mock is not resolving and whwn I log out the result of the mock I get:
Promise { <pending> }
I have mocked promises in the past with sinon however it has been a while since I needed to do that.
What I am doing wrong? How do I get the mocked stub to resolve the promise?