Skip to content

test(governance): cover disconnect reset and isVotingClosed matrix (#857) - #1023

Merged
k-deejah merged 1 commit into
Sorokit:mainfrom
BernardOnuh:test/issue-857-governance-reset-coverage
Oct 22, 2026
Merged

k-deejah merged 1 commit into
Sorokit:mainfrom
BernardOnuh:test/issue-857-governance-reset-coverage

Conversation

@BernardOnuh

Copy link
Copy Markdown
Contributor

Closes #857

Why this PR exists

All three acceptance criteria of #857 were already satisfied on main before I started — the issue's dead stub premise is stale. Full audit with commit-by-commit evidence is in my comment on #857:

  • src/components/GovernanceDashboard.tsx is not a <div>Governance Voting Dashboard</div> stub — it is a 709-line, fully documented implementation (typed GovernanceDashboardProps, proposal list, vote dialog, delegation panel) added in f86f69c1 (Sep 26, @Dominion116) and hardened in 25bf29c2 (Oct 16, @samsondev23)
  • It has a real 19-test suite (GovernanceDashboard.test.tsx) — the latter landed after the issue was filed, which is likely why the issue stayed open: neither commit referenced GovernanceDashboard.tsx is dead code — stub, not exported, no tests #857

Since there is no production code to change (deleting the component or downgrading its tests to it.todo would remove working code), this PR gives the issue a reviewable, linked diff by adding regression coverage for two behaviours that were genuinely untested.

AC status

AC State on main before this PR This PR
File deleted OR properly scaffolded placeholder with export and stub test ✅ full implementation + export from src/components/index.ts:248-253 + 19 real tests (supersedes an it.todo stub) —
exports.test.ts updated accordingly ✅ src/__tests__/exports.test.ts asserts the component and all 4 exported types; src/components/exports.test.ts smoke-tests the barrel —
No dangling import or reference ✅ wired into src/screens/Dashboard.tsx, README (×2), src/verify-exports.ts — git grep confirms every reference resolves —

What was changed, why, and how

File: src/components/GovernanceDashboard.test.tsx (test only, +43/−1)

  1. Disconnect reset (clears stale proposals and the delegate when the wallet disconnects) — the component has a wallet-disconnect effect that clears stale proposals and the cached delegate so they don't linger after account reset (it even carries a comment saying it mirrors SorokitProvider's account-reset effect). Nothing tested it: the test renders with a connected wallet, asserts proposals and the current delegate are shown, flips the mocked isConnected to false, re-renders, and asserts the proposals are gone, the "Connect your wallet" prompt appears, and the delegate panel falls back to None — voting for yourself.
  2. isVotingClosed matrix (returns true only for terminal statuses) — the exported helper gates all vote buttons but was only exercised indirectly for a single status. The test pins the full contract: closed/executed/passed/rejected → true, active/pending → false.

No changes to GovernanceDashboard.tsx itself.

Testing

  • vitest run src/components/GovernanceDashboard.test.tsx → 21/21 passed (19 pre-existing + 2 new)
  • vitest run (full suite) → 100 files / 2036 tests passed
  • eslint . --ext .ts,.tsx → clean
  • tsc -b --noEmit → clean

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@BernardOnuh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@k-deejah
k-deejah merged commit 018c3c0 into Sorokit:main Oct 22, 2026
4 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.

GovernanceDashboard.tsx is dead code — stub, not exported, no tests

3 participants