I want to test my nodejs code using Jest. In my code I use stripe.
When requiring stripe you have to use this line
const stripe=require('stripe')("apikey");
in order to be able to access the stripe methods.
Obviously that's the library I want to mock, but if I do
jest.mock('stripe');
I cannot mock the stripe methods I need as it's like doing a require without passing the key in the higher order function.
I could not find any correlation around.
Is there a way to achieve that?
Aucun commentaire:
Enregistrer un commentaire