Skip to content

test: Add regression test for key balance read returning zero#387

Closed
AbuJulaybeeb wants to merge 1 commit into
accesslayerorg:mainfrom
AbuJulaybeeb:feature/issue-369-balance-zero-test
Closed

test: Add regression test for key balance read returning zero#387
AbuJulaybeeb wants to merge 1 commit into
accesslayerorg:mainfrom
AbuJulaybeeb:feature/issue-369-balance-zero-test

Conversation

@AbuJulaybeeb
Copy link
Copy Markdown

Added a new regression test test_key_balance_read_returns_zero_for_address_with_no_buys to creator-keys/tests/key_balance.rs. This explicitly tests querying the key balance using a distinct, uninitialized wallet address that has not interacted with the contract.

Why it was done

To resolve #369 by guaranteeing that a valid wallet address that has never bought keys for a creator returns a zero balance natively. This confirms the read handles uninitialized holders gracefully rather than producing unexpected panics, errors, or null states.

How it was verified

The regression test initializes the environment, registers a creator, simulates an active buyer interacting with the contract, and queries the inactive_wallet. It successfully asserts that client.get_key_balance(&creator, &inactive_wallet) evaluates to 0 without throwing any errors.
Closes #369

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@AbuJulaybeeb 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! 🚀

Learn more about application limits

@Chucks1093 Chucks1093 closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add regression test for key balance read returning zero for address with no buys

2 participants