This project demonstrates writing Hardhat unit tests for a basic smart contract in Solidity.
Install nvm
if you don't have it already:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
Install and switch to node
version specified in .nvmrc
file:
nvm install
Install all needed dependencies:
npm install
Run the following to have the tests run once:
npx hardhat test
Run the following to have the tests in "watch" mode, where any changes to the contracts and test files will trigger compilation of the contracts (if necessary) and another run of the tests:
npm run test