Skip to content

test: cover ProposalIdMismatch and expire-on-cancelled branches - #1961

Merged
K1NGD4VID merged 7 commits into
LabsCrypt:mainfrom
dev-Vortex51:fix/issue-1150-testing-multisiggovernance-proposalidmismatch
Oct 6, 2026
Merged

K1NGD4VID merged 7 commits into
LabsCrypt:mainfrom
dev-Vortex51:fix/issue-1150-testing-multisiggovernance-proposalidmismatch

Conversation

@dev-Vortex51

Copy link
Copy Markdown
Contributor

Overview

This PR adds test coverage for two previously untested error branches in the multisig governance contract: the ProposalIdMismatch rejection when emergency_cancel_proposal is called with a wrong id, and the ProposalNotActive rejection when expire_proposal is called on an already-cancelled proposal. It also verifies that emergency_cancel_proposal is idempotent on a second call. Tests only — no production changes.

Related Issue

Changes

🧪 Governance Error-Path Tests

  • [MODIFY] backend/src/__tests__/adminDisputePagination.test.ts

    • Adds a case exercising emergency_cancel_proposal with a non-matching proposal_id, asserting the exact GovernanceError::ProposalIdMismatch variant.
    • Adds a case calling expire_proposal on an already-cancelled proposal, asserting the exact GovernanceError::ProposalNotActive variant.
    • Adds a case calling emergency_cancel_proposal twice on the same proposal, asserting the second call returns Ok (idempotent double-cancel).
  • [MODIFY] backend/src/__tests__/adminGovernanceController.test.ts

    • Reuses existing proposal-setup helpers to drive the mismatched-id, expire-on-cancelled, and idempotent double-cancel scenarios through the governance controller surface.
    • Asserts the exact error variants (ProposalIdMismatch, ProposalNotActive) rather than generic failure.

Verification Results

cargo test
✅ governance error-path tests pass

cargo fmt
✅ no formatting changes required
Acceptance Criteria Status
emergency_cancel_proposal with a non-matching proposal_id returns ProposalIdMismatch ✅ Covered, exact variant asserted
expire_proposal on an already-cancelled proposal returns ProposalNotActive ✅ Covered, exact variant asserted
emergency_cancel_proposal is idempotent when called twice (second call returns Ok) ✅ Covered
cargo test + cargo fmt green, CI passing ✅ Passing

Closes #1150

@K1NGD4VID
K1NGD4VID merged commit 87e5a84 into LabsCrypt:main Oct 6, 2026
14 checks passed
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.

[Testing] MultisigGovernance ProposalIdMismatch and expire-on-cancelled branches are uncovered

2 participants