You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Outside of the blockchain space it is common to use dynamic mocking instead. This reduces amount of code and allow to avoid context switching when writing and reading tests.
An example:
import{createMock}from'@ethereum-waffle/mock';// setup mockconsttokenMock=awaitcreateMock(wallet,['function balanceOf(address holder) view returns (uint)',]);constsomeContract=someContractFactory.deploy(tokenMock.address);// test against itit('reverts if no balance',async()=>{awaittokenMock.balanceOf.returns('0');awaitexpect(someContract.check()).to.be.revertedWith('Not enough balance');});it('returns true if positive balance',async()=>{awaittokenMock.balanceOf.returns('1000000'));expect(awaitsomeContract.check()).to.equal(true);});
The code will be based on Doppelganger, but will come with a range of novel features and improvements. The result should also include better documentation and tutorial.
The text was updated successfully, but these errors were encountered:
Motivation:
Common pattern in Smart Contract testing is to create mock smart contracts for testing.
Examples can be found here:
Outside of the blockchain space it is common to use dynamic mocking instead. This reduces amount of code and allow to avoid context switching when writing and reading tests.
An example:
Related feature: #229
The code will be based on Doppelganger, but will come with a range of novel features and improvements. The result should also include better documentation and tutorial.
The text was updated successfully, but these errors were encountered: