Lesson 9: 15:52:08; AssertionError: Expected transaction to be reverted with reason... #5638
-
https://youtu.be/gyMwXuJrbJQ?t=57128 When writing a unit test, I accidentally discovered something through a spelling mistake. When using
I received an error in the terminal stating:
This error alerted me into changing When using
the test passed successfully. QUESTION:
come from? In other words, How does one know to write the revertedWith() message as, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Nevermind! P.S. |
Beta Was this translation helpful? Give feedback.
-
@CryptoNube The error message must matches the error message that you are expecting from you smart contract. Since you are testing your smart contract's behavior for Reverts. |
Beta Was this translation helpful? Give feedback.
Nevermind!
Right after I posted this, I realized that I forgot to check the VRFCoordinatorV2Mock.sol contract from
"@chainlink/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol";
Indeed that is where the
revert("nonexistent request");
comes from.P.S.
I wish you could delete discussions in github because of things like this 🥴