Skip to content

test(wallet): unit tests for wallet disconnection and rejected transaction states (closes #78) - #90

Open
phatloi0010 wants to merge 1 commit into
Kinlock-Org:mainfrom
phatloi0010:test/wallet-errors-78
Open

phatloi0010 wants to merge 1 commit into
Kinlock-Org:mainfrom
phatloi0010:test/wallet-errors-78

Conversation

@phatloi0010

Copy link
Copy Markdown

Summary

Fulfills M3-02 and M3-21 hardening requirements by adding a comprehensive Vitest unit test suite in lib/wallet/__tests__/wallet-errors.test.ts covering wallet disconnection, user modal/transaction rejection, extension locked states, and fee/insufficient XLM errors.

Closes #78

Changes

  1. lib/wallet/__tests__/wallet-errors.test.ts:
    • Added 20 unit tests simulating Stellar Wallets Kit and browser extension error states.
    • Tested environment validation ensuring createStellarWalletsKitAdapter rejects immediately when called in SSR / non-browser environments.
    • Tested wallet disconnection: getAddress() safely returning null when the extension throws or returns an empty address, and clean delegation to k.disconnect().
    • Simulated modal connection rejection (User closed modal, USER_DECLINED) and verified user-facing recovery guidance.
    • Simulated transaction signing rejection across Freighter, Lobstr (Transaction was declined by user), and xBull (code: -4).
    • Simulated wallet extension locked states during both connect and transaction signing.
    • Simulated fee and reserve failures (tx_insufficient_fee, op_underfunded).
    • Verified SDK walletSigner bridge correctly propagates wallet signing failures.
    • Verified that all error messages displayed to users come from externalized strings in messages/en.json (pages.send.errorTx, pages.payee.connectError, pages.claim.errorTx, pages.lock.errorTx), upholding non-custodial honesty (hard rule 7).
  2. ROADMAP.md:
    • Refreshed Last updated header and added new Changelog entry for test/wallet-errors-78.

Verification

  • pnpm lint: PASS (Biome clean, 93 files checked)
  • pnpm typecheck: PASS (tsc --noEmit clean, 0 errors)
  • pnpm test: PASS (17 test files, 207 tests passing)
  • pnpm build: PASS (Turbopack production build successful)

@phatloi0010
phatloi0010 requested a review from a team as a code owner November 2, 2026 23: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.

test(app): unit tests for wallet disconnection and rejected transaction states

1 participant