What
Several learn-token query functions have no dedicated unit tests:
get_claim_history -- no test verifying returned records match actual claims
get_storage_size -- no test verifying the counter is accurate after various operations
total_minted_to -- no test verifying the per-address minted total
get_vesting_schedule -- tested indirectly via vesting flow but no dedicated query test
permit_nonce -- no test verifying nonce increments after permit
get_admins -- no test verifying the returned list
has_role -- no test verifying role checks
prune_expired_allowance -- no test verifying it removes expired entries
cleanup_expired_allowances -- no test verifying cleanup behavior
Why
Query functions are part of the public API and used by integrators. Without tests, regressions in these functions would go undetected.
Scope
Add unit tests for each listed function, verifying:
- Correct return values after state changes
- Edge cases (empty history, no entries, expired allowances)
- Consistency with the state-changing functions that populate the data
Acceptance Criteria
- Each listed function has at least one dedicated test
- Tests verify correct behavior, not just that the function doesn't panic
Technical Context
tests/unit/token_tests.rs -- existing token tests
contracts/learn-token/src/lib.rs -- function implementations
What
Several learn-token query functions have no dedicated unit tests:
get_claim_history-- no test verifying returned records match actual claimsget_storage_size-- no test verifying the counter is accurate after various operationstotal_minted_to-- no test verifying the per-address minted totalget_vesting_schedule-- tested indirectly via vesting flow but no dedicated query testpermit_nonce-- no test verifying nonce increments after permitget_admins-- no test verifying the returned listhas_role-- no test verifying role checksprune_expired_allowance-- no test verifying it removes expired entriescleanup_expired_allowances-- no test verifying cleanup behaviorWhy
Query functions are part of the public API and used by integrators. Without tests, regressions in these functions would go undetected.
Scope
Add unit tests for each listed function, verifying:
Acceptance Criteria
Technical Context
tests/unit/token_tests.rs-- existing token testscontracts/learn-token/src/lib.rs-- function implementations