Skip to content

Fix wrong expected panic string in token_tests.rs test_transfer_from_expired_allowance #183

Description

@DeFiVC

What

The test test_transfer_from_expired_allowance in tests/unit/token_tests.rs expects #[should_panic(expected = "allowance expired")] but the actual panic message is different.

Why

When an expired allowance is used, the contract emits an allowance_expired event and continues execution. The actual panic comes from get_allowance returning 0, followed by the "insufficient allowance" panic. The expected string will never match, so the test doesn't verify what it intends.

Scope

  • Update the #[should_panic(expected = "...")] attribute to match the actual panic string
  • Verify the test now correctly catches the intended behavior

Technical Context

  • File: tests/unit/token_tests.rs (line ~205)
  • The transfer_from function flow: check expiry → emit event → get allowance (returns 0) → panic with "insufficient allowance"

Acceptance Criteria

  • #[should_panic(expected = "...")] matches the actual panic string
  • Test passes with cargo test
  • Test still verifies the intended behavior (expired allowance rejection)

Activity

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

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programlowCosmetic, minor improvement, code quality, documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions