Test scenarios verifying the correct behavior of the following contracts:
- Diamond
- ERC-20
- ERC-721
- ERC-1155
- HIP-583
- HTS-Precompile [ERC-20, ERC-721, token-create, token-management, token-query, token-transfer]
- SafeHTS
The tests are implmented in an independent manner, so they can be executed all, by test set or a single test.
Running "npx hardhat test" in the terminal will execute all the existing tests. If you want to execute specific test set or single test you should:
- Open the desired test suite - Ex. ERC20.js
- Add "only" to the desired describe/it - Ex. describe.only || it.only
- Run in the terminal "npx hardhat test" for all tests
- Run in the terminal "npx hardhat test ./test/test.file.js" || "npx hardhat test --grep ERC20" for running a specific file
- Open VSCode
- Open Run & Debug
- Click on "Create a launch.json file" and paste the following json:
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Hardhat Tests",
"runtimeArgs": [
"--preserve-symlinks",
"--preserve-symlinks-main"
],
"program": "${workspaceFolder}/node_modules/hardhat/internal/cli/cli.js",
"args": [
"test"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"cwd": "${workspaceFolder}"
}
]
}
- Use the Play button from the Run & Debug section to execute the tests.
- Start the local node: npx hedera start -d --network ${networkName}
Network specific configurations can be applied using the -n/--network option when starting/restarting the local node. Pre-configured options are mainnet, previewnet, testnet and local.