Conversation
…nLearnOfficial#505) - Add dedicated unit tests covering: - get_claim_history (verifying claim records and empty state) - get_storage_size (verifying persistent storage growth across operations) - total_minted_to (verifying per-address mint totals vs transfers) - get_vesting_schedule (verifying query accuracy for registered/unregistered beneficiaries) - permit_nonce (verifying initial state and increments per address) - get_admins (verifying admin listings and role assignments) - has_role (verifying role hierarchy and queries) - prune_expired_allowance (verifying selective pruning and idempotency) - cleanup_expired_allowances (verifying bulk expiration sweeps) - Fix upstream syntax split and ledger sequence alignment in token_tests.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #505.
This PR adds dedicated unit tests for all 9
learn-tokenquery functions as requested:get_claim_history(test_get_claim_history_query): verifies claim records match actual reward claims, order is preserved, and returns empty for accounts with no claim history.get_storage_size(test_get_storage_size_query): verifies that persistent storage counters increase as new entries (mints, allowance spenders, vesting, claim records) are created.total_minted_to(test_total_minted_to_query): verifies per-address accumulated mint totals across multiple mints and claims, and confirms token transfers do not alter minted totals.get_vesting_schedule(test_get_vesting_schedule_query): verifies exact schedule parameters for registered beneficiaries and returnsNonefor non-beneficiaries.permit_nonce(test_permit_nonce_query): verifies nonce initialization to 0 and proper per-address increments upon permit consumption.get_admins(test_get_admins_query): verifies initial admin listing, additions of admins/pausers, and removals.has_role(test_has_role_query): verifies role queries and hierarchy (including main admin all-role access and role grants/revocations).prune_expired_allowance(test_prune_expired_allowance_query): verifies selective removal of expired allowances while preserving active ones, and confirms idempotency.cleanup_expired_allowances(test_cleanup_expired_allowances_query): verifies bulk allowance sweeps, empty account handling, and spender count tracking.Additionally resolves test setup syntax splicing and sequence alignment in
token_tests.rs.Testing
cargo test --test token_tests: All 87 unit tests passed green.cargo clippy --test token_tests: 0 warnings.