Jest mocking jose-jwe-jws

Viewed 19

I'm using jose-jwe-jws encryption in Angular app.

Setting up encryptor method calls Jose.Utils.importRsaPublicKey(jwk, 'RSA-OAEP-256');

Any method used to mock Jose is failing.

jest.mock('jose-jwe-jws', () => ({ Utils: jest.fn(() => ({})) })); still returns TypeError: Cannot read properties of undefined (reading 'Utils')

Creating a custom stub class and adding it to providers in spec does not allow to specify Utils or any other nested properties.

What is the proper way to mock external module?

0 Answers
Related