Below is a showcase of various examples of unit testing real and sample Algorand Python smart contracts using algorand-typescript-testing
.
Contract Name | Test File | Key Features Demonstrated | Test versions of Algorand TypeScript Abstractions used |
---|---|---|---|
Auction | contract.algo.ts | - Use of TestExecutionContext - Mocking of global state and transaction fields - Testing of ARC4 contract methods - Emulation of asset creation and transfers - Verification of inner transactions |
- arc4.Contract - Global - Txn - Asset - Account - LocalState |
Proof of Attendance | contract.algo.ts | - Creation and management of dummy assets - Testing of box storage operations - Verification of inner transactions for asset transfers - Use of any_* methods for generating test data |
- arc4.Contract - Box - BoxMap - Asset - Account - op |
Simple Voting | contract.algo.ts | - Testing of global and local state operations - Verification of transaction group operations - Mocking of payment transactions |
- BaseContract - GlobalState - LocalState - Txn - op.GTxn |
ZK Whitelist | contract.algo.ts | - Testing of zero-knowledge proof verification - Mocking of external application calls - Use of ARC4 types and methods |
- arc4.Contract - arc4 types - LocalState - Global - Txn |
HTLC LogicSig | signature.algo.ts | - Testing of LogicSig contracts - Verification of time-based conditions - Mocking of transaction parameters |
- logicsig - Account - Txn - Global - op |
Marketplace | contract.algo.ts | - Testing of complex marketplace operations - Use of BoxMap for listings - Testing of asset transfers and payments |
- arc4.Contract - BoxMap - Asset - arc4 types - Global - Txn |
Scratch Storage | contract.algo.ts | - Testing of scratch space usage - Verification of scratch slot values |
- arc4.Contract - Contract - op |