In Unit-tests from OZ there is code like
contract('ERC20Burnable', function (accounts) {
const [ owner, ...otherAccounts ] = accounts;
const initialBalance = new BN(1000);
const name = 'My Token';
const symbol = 'MTKN';
beforeEach(async function () {
this.token = await ERC20BurnableMock.new(name, symbol, owner, initialBalance, { from: owner });
});
shouldBehaveLikeERC20Burnable(owner, initialBalance, otherAccounts);
});
I could use the same blocks in my own hardhat-projects.
Where comes the contract
-block-statement from?
Against to a describe
-block, It seems to be able to have a this
-statement where we can save some member variables for shared unit-test-functions ("shouldBehaveLikeSomething"). Also it seems to have the capabalities of executing beforeEach
even when there is a function call and not an it
-function.
I want this also in my own hardhat based projects But the normal hardhat-stuff doesnt offer it.