How to mock CognitoJwtVerifier.create().verify - Jest - Unit Testing
sandun86 opened this issue · 2 comments
sandun86 commented
How can we mock the following code using Jest
const verifier = CognitoJwtVerifier.create({
userPoolId: 'userPoolId',
tokenUse: 'access',
clientId: 'clientId',
});
const payload = await verifier.verify(awsCognitoToken);
ottokruse commented
Hi @sandun86 what exactly do you want to do, what problem do you encounter?
Here's a simple mock:
const mock = { create: () => ({ verify: async (jwt) => ({ claim: "claim value" }) }) };
ottokruse commented
Closing for now, let us you if you still have questions