Foundry supports the use of cheatcodes. Cheatcodes allow you to go beyond testing the outputs of your smart contracts. They allow developers to manipulate the state of the blockchain, test for reverts,
and events. In this tutorial, we will focus on the cheatcode vm.expectEmit to test a solidity event.
- ✅ Use the vm.expectEmit Cheatcode
- ✅ Test a Solidity event
The repo, github.com/hedera-dev/test-an-event-with-foundry, is intended to be used alongside this tutorial.
Important
This project has submodules. You must initialize the submodule configuration file and fetch all submodule data from the project. To do this run the following command:
git clone --recurse-submodules git@github.com:hedera-dev/test-an-event-with-foundry.gitTo skip ahead to the final state, use the completed branch. This gives you the final state with which you can compare your implementation to the completed steps of the tutorial.