Skip to content

get_claim_history and get_storage_size are missing from learn-token unit tests #505

Description

@DeFiVC

What

Several learn-token query functions have no dedicated unit tests:

  1. get_claim_history -- no test verifying returned records match actual claims
  2. get_storage_size -- no test verifying the counter is accurate after various operations
  3. total_minted_to -- no test verifying the per-address minted total
  4. get_vesting_schedule -- tested indirectly via vesting flow but no dedicated query test
  5. permit_nonce -- no test verifying nonce increments after permit
  6. get_admins -- no test verifying the returned list
  7. has_role -- no test verifying role checks
  8. prune_expired_allowance -- no test verifying it removes expired entries
  9. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programlowCosmetic, minor improvement, code quality, documentationrustRust languagetestsTest additions or improvements

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions