Skip to content

test(wallet): cover WalletAction status/disconnect + availableToStake#379

Merged
MuncleUscles merged 1 commit into
v0.40-devfrom
feat/cli-wallet-test-coverage
Jul 9, 2026
Merged

test(wallet): cover WalletAction status/disconnect + availableToStake#379
MuncleUscles merged 1 commit into
v0.40-devfrom
feat/cli-wallet-test-coverage

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

Closes concrete unit-test gaps on the browser-wallet surface (follow-up to #367).

What's added

  • tests/actions/walletStatusDisconnect.test.ts (10 tests) — mirrors the mocking style of walletConnect.test.ts (mocked sessionDescriptor + WalletSessionClient), fully hermetic.
    • WalletAction.status: no descriptor → No active wallet session. + exit 1; live connected → prints the status object (address/network/chainId/port/url/heartbeat/queuedTransactions) + exit 0; live-but-connecting → connecting + exit 1; stale tab heartbeat → reports stale (still exit 0); stale descriptor via dead pid and via failed ping → warn + removeDescriptor + exit 1 (state never read).
    • WalletAction.disconnect: no descriptor → message, no throw, no client; live daemon clean exit → shutdown() + removeDescriptor + no SIGTERM; pid lingers → SIGTERM fallback then cleanup; racing exit (waitForPidGone false but pid already gone) → no SIGTERM, still cleans up. process.kill spied so no real signal is sent.
  • tests/libs/availableToStake.test.ts (4 tests) — direct coverage of vestingAvailableToStake: revoked → 0n with getBalance never called; not-revoked → returns getBalance({address}) asserted against the vesting address; zero-balance passthrough; failing read propagates (no silent 0).

Scope

Primary deliverables A/B/C only. No Tier-1 D item added: the E2E design's Tier-1 candidates (resolver chain-mismatch/degrade/error modes, sessionClient.waitForTxResult timeout/tab-closed fail-fast, config-default resolveWalletMode) are already covered by existing sessionResolver/sessionClient/walletSession specs; the bridge result-store GC is a private method reachable only by driving the full HTTP loop, not a cheap standalone unit spec.

Verification

  • npm run build clean.
  • npx vitest run full suite green: 72 files, 747 tests passed (+14 from this PR).
  • tsc --noEmit baseline unchanged (32 pre-existing SDK-typing errors; zero in the new files).

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ecb9fb1d-d507-4e8a-9942-7dca21f4aae0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-wallet-test-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MuncleUscles MuncleUscles merged commit 121ab27 into v0.40-dev Jul 9, 2026
9 of 10 checks passed
@MuncleUscles MuncleUscles deleted the feat/cli-wallet-test-coverage branch July 9, 2026 20:01
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.

1 participant