Add unit tests for treasury address reads#48
Merged
Conversation
- Add test for get_key_balance with unregistered creator (returns 0) - Add test for is_creator_registered with unregistered creator (returns false) - Add test for get_total_key_supply with unregistered creator (returns 0) - Add test for get_key_balance with unregistered wallet (returns 0) - Add test for get_key_balance with registered creator but unregistered wallet (returns 0) All tests verify expected behavior for missing creators/wallets
- Add snapshots for 4 new unit tests - Snapshots verify contract state after read operations on unregistered creators
- Add test for get_treasury_address returns None initially - Add test for get_treasury_address returns set address - Add test for get_treasury_address persists across reads - Add test for get_creator_fee_config returns defaults for unregistered All tests verify expected read behavior with clear assertions
- Add snapshots for 4 new unit tests - Snapshots verify contract state for treasury address reads
|
@Olowodarey Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Adds focused unit tests for treasury address read operations, verifying predictable behavior across different states (unset, set, and persistent reads).
Changes
New Unit Tests (3 tests for treasury address)
test_get_treasury_address_returns_none_initially
get_treasury_addressreturnsNonewhen no address is configuredtest_get_treasury_address_returns_set_address
get_treasury_addressreturns the configured address after settingtest_get_treasury_address_persists_across_reads
get_treasury_addressreturns consistent results across multiple readsAdditional Test (1 test for creator fee config)
get_creator_fee_configreturns default values for unregistered creatorsTest Characteristics
Testing
All tests pass:
Acceptance Criteria
Quality Checks
cargo test)cargo fmt)cargo clippy)Design Notes
These unit tests complement the existing integration tests in
tests/treasury_address.rsby providing focused, isolated coverage at the unit level. They verify:NoneThe tests follow the same pattern as other read method tests, ensuring consistency across the test suite.
closes #38
closes #39