How would you test the following function with solidity v0.7 and hardhat v2.3.3?
function myFunction(int8 _num) public {
require(_num > 5, "Num should be bigger than 5");
...
}
I've tried:
try {
await contract.myFunction(3);
} catch(error) {
expect(error).to.equals("Num should be bigger than 5");
};
And also:
expect.fail(await contract.myFunction(3));
But I always get:
Error: VM Exception while processing transaction: revert Num should be bigger than 5
Which seems to me the Virtual Machine breaking off with the test failing in the spot, without even having the chance to catch the error.