Unit Testing Smart Contracts
It is essential to write unit tests for your smart contracts. It is a good practice to unit test before deploying your smart contracts.
In this tutorial, we provide two examples of unit testing using Hardhat and Truffle.
Each example repository contains the following:
contractsfolder: contains smart contract files.
testfolder: the unit test files are under the test folder
README.mdfile: contains instructions for compiling, testing, deploying, and verifying the smart contracts.
- 1.Checking if a value is what is expected
- 2.Checking if an event is fired with the correct arguments
- 3.Checking if a revert has occurred