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
What
The test
test_transfer_from_expired_allowanceintests/unit/token_tests.rsexpects#[should_panic(expected = "allowance expired")]but the actual panic message is different.Why
When an expired allowance is used, the contract emits an
allowance_expiredevent and continues execution. The actual panic comes fromget_allowancereturning 0, followed by the"insufficient allowance"panic. The expected string will never match, so the test doesn't verify what it intends.Scope
#[should_panic(expected = "...")]attribute to match the actual panic stringTechnical Context
tests/unit/token_tests.rs(line ~205)transfer_fromfunction flow: check expiry → emit event → get allowance (returns 0) → panic with "insufficient allowance"Acceptance Criteria
#[should_panic(expected = "...")]matches the actual panic stringcargo test