Write React Testing Library assertions for wallet disconnect handler … - #364
Merged
Conversation
- Replace hardcoded empty message with EmptyStateCard component - Display briefcase icon for job-related context - Show descriptive title and explanation text - Include role badges (Client, Freelancer, Arbiter) showing available participation options - Add comprehensive test coverage with 16 test cases - Ensure proper accessibility with region landmarks and aria-labels - Validates placeholder display under empty data states
|
@madisonsc52-del 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! 🚀 |
Contributor
Author
|
@godamongstmen897 |
Contributor
|
Fix failed CI check @madisonsc52-del |
Contributor
Author
|
@godamongstmen897 |
Contributor
|
Fix failed CI check |
Contributor
Author
|
OKAY LET ME WORK ON IT |
Contributor
Author
|
@godamongstmen897 |
Contributor
|
Fix failed CI check |
…handled rejections
- vitest.config.mts: inline @stellar/freighter-api + @creit.tech/stellar-wallets-kit
so Vite (not Node) does the CJS->ESM interop. Node's named-export detection on
freighter-api's minified UMD bundle only yields {default, freighterApi}, so the
kit's 'import { getAddress }' threw a SyntaxError that killed every suite
importing app/context/WalletContext.tsx.
- freighter_multisig_hook.test.ts: replace base64('aaaa...') fixtures with real
signed testnet envelopes built via TransactionBuilder.
- signature_timeout_alert_timeout.test.ts: attach rejection handlers before
advancing fake timers so Node's unhandled-rejection sweep does not fire.
- signature_timeout_alert.test.tsx: await the loader overlay instead of querying
synchronously after a React state update.
- SignatureTimeoutAlert.tsx: remove the dangling expression left behind by the
useMemo refactor.
Contributor
Author
|
@godamongstmen897 |
…allet-disconnect-handler-Goldii-locks#242-FIX
…allet-disconnect-handler-Goldii-locks#242-FIX
…allet-disconnect-handler-Goldii-locks#242-FIX
The PR imported EmptyStateCard but never added the component, so the dashboard would not build. Added it, satisfying this PR's contract (dashboard-empty-state test id, region role with an aria-label, an SVG briefcase icon and role badges) while also carrying the shared empty-state/-title/-description ids the existing dashboard empty-state test queries. The description now carries both wordings so the existing assertion (/create one to get started/i) and this PR's fuller copy both hold.
…allet-disconnect-handler-Goldii-locks#242-FIX
…y-state-ui feat: implement descriptive empty state UI for dashboard jobs list
…torybook-318 Build Storybook interface mocks for dark_mode_switcher
The branch was pushed with a botched conflict resolution: the `>>>>>>>` markers were stripped but the branch-name lines and both sides of each conflict were left in place. That left four stray `Write-React-Testing-Library-assertions-...-Goldii-locks#242-FIX` lines, a duplicate `@stellar/stellar-sdk` import block, a second `parseMessage` useMemo in SignatureTimeoutAlert, and a duplicate `server` key in vitest.config.mts. Resolved by taking main for the five files the branch only touched incidentally -- main already carries the equivalent, deduplicated work (the same parseMessage useMemo derivation and the same freighter-api inline config the branch was re-adding). The branch's actual deliverable for Goldii-locks#242 is kept intact: WALLET_DISCONNECT_HANDLER_TESTS.md and the 851-line wallet_disconnect_handler.component.test.ts. lint 0 errors / tsc 0 errors / 1776 tests passing / build OK
godamongstmen897
added a commit
to udeachudivine-spec/escrow-frontend
that referenced
this pull request
Aug 31, 2026
… suites Navbar (4 conflicts): kept main's design tokens and the props its side passes (isConnecting, providerName, networkMismatch) -- the branch's side replaced that block with a status="connected" badge and dropped those three -- while taking the branch's mobile fixes: relative z-10, px-4 sm:px-6, py-3 sm:py-4, gap-2, flex-wrap, min-w-0 and shrink-0 on the brand link and badge. That is the actual Goldii-locks#259 deliverable. wallet_disconnect_handler (3 conflicts): the third was git aligning the branch's disconnectWalletWithCheck body onto withWalletDisconnectLoader again, as in Goldii-locks#357 and Goldii-locks#371. Kept main's loader body; the branch's pendingTx warning runs before the loader is entered, and its success log sits on the real success path. Both Goldii-locks#357's options and this branch's pendingTx wanted the 4th parameter, so options stays 4th and pendingTx is 5th; the one call site passing it now passes undefined for options. The logging levels were a genuine three-way conflict. This branch (Goldii-locks#241) moves failures to console.error carrying the Error so the stack survives, and adds a success log. Goldii-locks#364's component suite, already on main, asserted the old behaviour: warn on failure, and complete silence on success. Settled as: success console.info (informational -- keeps Goldii-locks#364's "no warn, no error" assertion true) disconnect failure console.error(tag, err) availability check failure console.error(tag, err) pending transaction console.warn wallet not installed console.warn Updated the assertions that described the superseded levels: four failure checks in wallet_disconnect_handler.component.test.ts moved from warnSpy to errorSpy, and this branch's success/pending-tx counts now account for console.info. No assertion changed what it verifies. lint 0 errors / tsc 0 errors / 1996 tests passing / build OK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Findings
The issue was insufficient test coverage for
app/lib/wallet_disconnect_handler.ts, particularly around the coredisconnectWalletWithCheck()function.The module handles wallet detection, availability checks, setup instructions, install URLs, and safe wallet disconnection.
Existing tests provided good coverage for wallet detection and availability checks.
However,
disconnectWalletWithCheck()had only 8 basic tests.Missing coverage included:
Successful mocked wallet disconnects
Error and non-Error failures
Concurrent and sequential disconnects
Delayed async operations
Logging behavior
Result object validation
Edge cases such as empty IDs, long errors, and synchronous throws
Window global integration
Fix Features
A new component test suite was added:
__tests__/wallet_disconnect_handler.component.test.tsIt includes:
55 new tests
13 test suites
Extensive
vi.fn()wallet action mockingThe tests cover:
Successful disconnects for all supported wallets
Error-based disconnect failures
Non-Error throws, including strings, numbers, objects,
null, andundefinedWallet-not-installed behavior
Detector failures
Sequential and parallel disconnect operations
Delayed and asynchronous operations
Logging behavior
WalletDisconnectResultstructureEdge cases and repeated calls
Window global detection and override behavior
Detailed availability and fallback scenarios
Wallet Coverage
The test suite covers all supported wallets:
Freighter
Albedo
xBull
Hana
Each wallet is tested across relevant success, failure, missing-installation, and detection scenarios.
Validation
Test results:
Final Result
Bottom line: The production implementation was not changed. The fix addresses the testing gap by adding comprehensive mocked wallet-action coverage for
disconnectWalletWithCheck()and related wallet detection behavior, with all 89 tests passing.CLOSE #242