Testing Overview
Zaphenath includes a full suite of tests written with the Foundry framework (forge-std). These tests ensure the core behaviors of the system are enforced reliably across key lifecycle operations, access control, and timeout logic.
โ Test File
test/Zaphenath.t.sol
This file contains unit tests for:
- Key creation and uniqueness
- Ping mechanics
- Read conditions before and after timeout
- Custodian assignments and role enforcement
- Key updates and deletions
๐ง How to Run Tests
forge test -vv
-vvenables verbose output includingconsole.logtraces.- All tests are self-contained and simulate user addresses using
vm.prank().
๐ Example Assertion
assertEq(data, bytes("Soli Deo Gloria"));
Used to verify key content and state mutations.
๐งช Test Helpers
vm.warp()to simulate time passingvm.expectRevert()to test failure conditionsvm.prank(address)to impersonate users
๐ Suggested Additions
- Fuzz tests for timeout edge cases
- Property tests for role escalations and demotions
- Integration tests across multiple keys and users
โก๏ธ Learn about Writing Custom Tests