How do I mock a contract when testing using Hardhat?

Viewed 230

I'm trying every solution I find online but I still can't figure it out.

I have two contracts and I'm trying to write some tests for one of them, let's just call them ContractA and ContractM (M for Mock). I'm now writing tests for ContractA and I need to mock a single function from ContractM.

I've also tried using the deployMockContract() function explained in the Waffle Documentation but I have no idea how to get the ABI of my contract. Every example I've found does import IERC20 from "../build/IERC20.json" but these use cases differ much from mine as far as I can see.

1 Answers

Try out the smock hardhat contracts mocking library.

Related