Skip to content

Add test coverage for AnchorDetail's and SettlementDetail's confirm-dialog cancel path #323

Description

@Jagadeeshftw

📌 Description

AnchorDetail.test.tsx has a test, "confirms before deactivating the anchor", that opens the ConfirmDialog and clicks its confirm button, asserting deregisterAnchor is called. SettlementDetail.test.tsx has the equivalent "confirms before cancelling a pending settlement" test for cancelSettlement. Neither test file has any test for the opposite path — a user opening the confirm dialog and then backing out (clicking Cancel, the backdrop, or pressing Escape) without confirming. ConfirmDialog itself is thoroughly unit-tested for this cancel behavior in isolation (ConfirmDialog.test.tsx), but nothing currently verifies the integration wiring in AnchorDetail/SettlementDetail — that their onCancel handlers correctly just close the dialog without invoking deregisterAnchor/cancelSettlement. A future refactor that accidentally wired onCancel to the destructive action (or removed the distinction between the two callbacks) would go completely undetected by either component's current test suite.

🧩 Requirements and context

  • Add a test to AnchorDetail.test.tsx that opens the deactivate confirm dialog, cancels it, and asserts deregisterAnchor was never called and the anchor's status is unchanged.
  • Add a test to SettlementDetail.test.tsx that opens the cancel-settlement confirm dialog, cancels it, and asserts cancelSettlement was never called and the settlement's status is unchanged.
  • No production code changes are expected; this is purely closing an integration-level test-coverage gap on already-shipped confirm/cancel wiring.

🛠️ Suggested execution

  • In src/components/AnchorDetail.test.tsx, render AnchorDetail with an active anchor, click "Deactivate" to open the dialog, click the dialog's "Cancel" button, and assert deregisterAnchor was not called and the anchor still renders as "Active".
  • In src/components/SettlementDetail.test.tsx, render SettlementDetail with a pending settlement, click "Cancel" to open the dialog, click "Keep settlement", and assert cancelSettlement was not called and the settlement still renders as "Pending".

✅ Acceptance criteria

  • AnchorDetail has test coverage asserting a cancelled confirm dialog does not deactivate the anchor.
  • SettlementDetail has test coverage asserting a cancelled confirm dialog does not cancel the settlement.
  • Both tests assert the underlying API function was never called.

🔒 Security notes

No new attack surface; a test-coverage task on already-shipped confirm/cancel logic.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26frontendFrontend / UI worktestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions