Recently I upgrade the react-okra library and have transitioned the app to use the new hooks. I am updating my tests now and this is what is happening:
const { authState, authService } = useOktaAuth();
// TypeError: Cannot destructure property `authState` of 'undefined' or 'null'
In order to fix that, I tried mocking the hook by doing:
jest.mock('@okta/okta-react', () => ({
useOktaAuth: () => {
return {
authState: {},
authService: {}
};
}
}));
That isn’t working. Any ideas on how to test these components?
Thanks