Closed br0wnD3v closed 2 years ago
revertWithCustomError()
did help me so I'll probably close the issue now.
await expect(
lotteryContract.enterLottery()
).to.be.revertedWithCustomError(
lotteryContract,
"Lottery__InsufficientFunds"
);
Hello there, In lesson 9's testing part, I want the transaction to fail with the custom error
error Lottery__InsufficientFunds()
and it IS failing with that custom error BUT when I doI get an Assertion Error :
AssertionError: Expected transaction to be reverted with reason 'Lottery__InsufficientFunds', but it reverted with a custom error
My Solidity code block for enterLottery() :
I defined the error under
contract Lottery is VRFConsumerBaseV2, KeeperCompatibleInterface {}
aserror Lottery__InsufficientFunds();
Any help is appreciated :) Stuck on it for quite some time.
NOTE : If I edit the expect() to
It works like it intended to be and the test passes.