typescript-solidity-dev-starter-kit icon indicating copy to clipboard operation
typescript-solidity-dev-starter-kit copied to clipboard

"Called on contract" chai matchers don't work

Open PaulRBerg opened this issue 5 years ago • 2 comments

Description

As per the waffle docs, we should be able to use the calledOnContract and calledOnContractWith chai matchers:

await token.balanceOf(wallet.address)

expect('balanceOf').to.be.calledOnContract(token);

But they don't work in this project.

How to Reproduce

Modify the "should count up" test like this:

it("should count up", async () => {
  await counter.countUp();
  let count = await counter.getCount();
  expect(count).to.eq(1);
  expect("getCount").to.be.calledOnContract(counter);
});

You will get the following error when running the test:

TypeError: contract.provider must be a MockProvider

PaulRBerg avatar Jun 06 '20 06:06 PaulRBerg

After a bit of investigation, I found out that this is a bug, either in Waffle or in Buidler's integration thereof: https://github.com/nomiclabs/buidler/issues/638

PaulRBerg avatar Jun 06 '20 11:06 PaulRBerg

Thanks for reporting. I'll watch the linked issues and add this to the examples.

rhlsthrm avatar Jun 06 '20 16:06 rhlsthrm