2

In the real app, I'm using the web3-react hook to inject the provider, etc. How do I best mock that/replicate that in a Jest Typescript environment?

2

I was running with this problem and you can inject it with ganache-cli

const ethereumObject = require("ganache-cli").provider();

You can check out more here: https://michalzalecki.com/integration-tests-with-web3-ganache-cli-and-jest/ - I'm using ethers and it works!

Kinda late but I hope this helps someone

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.