Skip to content

test(learn-token): add allowance_spender_count unit tests (fixes #635) - #651

Closed
lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:test/issue-635-allowance-spender-count-tests
Closed

lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:test/issue-635-allowance-spender-count-tests

Conversation

@lmduy2612

Copy link
Copy Markdown

Closes #635.

Summary of Changes

Adds comprehensive unit tests for allowance_spender_count in contracts/learn-token:

  • Owner with no allowances: verifies returning 0 (test_allowance_spender_count_returns_zero_for_owner_with_no_allowances).
  • Single allowance: verifies returning 1 after one approval (test_allowance_spender_count_returns_one_after_one_approve).
  • Multiple allowances: verifies returning 2 after approvals to two distinct spenders (test_allowance_spender_count_returns_two_after_two_approves_to_different_spenders).
  • Expired allowance persistence: verifies that spender count does not decrease when an allowance expires, proving the spender registry remains intact until explicit cleanup (test_allowance_spender_count_does_not_decrease_when_allowance_expires).

Verification

  • cargo test --test token_tests test_allowance_spender_count: 4/4 tests pass.
  • Adheres strictly to project coding standards and test conventions.

@DeFiVC DeFiVC closed this Oct 19, 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 allowance_spender_count unit tests

2 participants