test: WalletStatusCard state coverage, wallet-api tests, e2e, escrow contract tests - #1747
Merged
yusuftomilola merged 5 commits intoAug 31, 2026
Conversation
…port wallet-api.ts's only API client had no test file. Adds tests for every exported function's success path (getWalletStatus, provisionCustodialWallet, requestLinkChallenge, verifyLinkChallenge) and walletFetch's non-ok error path, covering both a JSON error body (with and without a message field) and a non-JSON body. Writing the error-path test surfaced a real bug blocking it entirely: walletFetch's non-ok branch calls Sentry.captureException(...), but Sentry was never imported in this file - every failed wallet request would throw a ReferenceError instead of the intended error, in production as much as in a test. Added the same "import * as Sentry from @sentry/nextjs" used elsewhere in this app (app/wallet/error.tsx). Closes DistinctCodes#1705
Only an accessibility test existed. Adds coverage of: initial load,
load error, provision flow (success and failure), link-challenge flow,
and link-verify (success and failure) — every state transition the
component makes.
Both this new suite and the pre-existing a11y test needed a
QueryClientProvider wrapper: WalletStatusCard calls useQuery/useMutation,
which throw ("No QueryClient set") without one. The a11y test's bare
render(<WalletStatusCard accessToken="test-token" />) call was passing a
prop the component doesn't accept (it reads auth from useSessionStore, not
a prop) and had no provider — fixed both alongside adding the real
coverage, since it's the same gap.
Closes DistinctCodes#1704
…ioning CI already runs a Frontend E2E job (.github/workflows/CI.yaml) and playwright.config.ts already pointed testDir at ./e2e, but that directory never existed — the job was passing purely because test:e2e uses --pass-with-no-tests, so it silently ran zero tests on every PR. Adds e2e/wallet.spec.ts covering the wallet load + provisioning flow (the one flow that currently works end to end), plus a load-error case. The backend is mocked via page.route() rather than started for real, keeping the test self-contained; /wallet is a protected route, so a fake accessToken cookie is set first (middleware.ts only verifies the JWT signature when JWT_SECRET is set, which it isn't in this test run). Also adds a webServer block to playwright.config.ts so `npx playwright test` (and CI) start the Next.js dev server themselves — nothing did that before either. Closes DistinctCodes#1706
…d/get_status
Chains create -> get_status=Locked -> release -> get_status=Released, and
the equivalent refund path, using soroban-sdk's testutils (mock_all_auths,
Address::generate, a registered contract client) — matches the CI job's
own dependency-management ("Contracts — Cargo workspace build") pattern.
Verification note: cargo test -p payment_escrow initially failed to
compile soroban-sdk's own testutils.rs at all ("cannot find crate
serde_json"/"rand") — root cause was contracts/.cargo/config.toml pinning
`[build] target = "wasm32-unknown-unknown"` as the default for every
cargo invocation including `test`, and rand's OS-entropy code isn't
available on bare wasm32. `cargo test --target x86_64-pc-windows-msvc`
gets past that and compiles most of the dependency graph, but then hits
a genuine version conflict inside soroban-env-host 21.2.1 itself
(`ChaCha20Rng` doesn't satisfy the `CryptoRng` bound `ed25519-dalek`
expects — two different major versions of ed25519-dalek coexist in this
workspace's Cargo.lock). That's an upstream dependency-graph issue,
unrelated to this file's code, and out of scope to fix here (it would
mean re-resolving/pinning versions workspace-wide, not something four
test-coverage issues should carry). I'm confident in the tests themselves
from manual review against soroban-sdk 21.x's documented testutils API,
but could not get a passing `cargo test` run to confirm — flagging for
CI/reviewer attention.
Closes DistinctCodes#1707
|
@A6dulmalik is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@A6dulmalik 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! 🚀 |
yusuftomilola
approved these changes
Aug 31, 2026
yusuftomilola
left a comment
Collaborator
There was a problem hiding this comment.
No merge conflicts with main. Good test coverage additions for WalletStatusCard state handling, wallet-api, the e2e suite, and the escrow contract - approving.
2 tasks
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.
Summary
Four test-coverage fixes across the frontend and the escrow contract:
#1705 —
wallet-api.tstestsAdded tests for every exported function's success path and
walletFetch'snon-ok error path (JSON error body with/without a
messagefield, and anon-JSON body). Writing the error-path test surfaced a real bug blocking
it entirely:
walletFetch's non-ok branch callsSentry.captureException(...), butSentrywas never imported in thisfile — every failed wallet request would throw a
ReferenceErrorinsteadof the intended error, in production as much as in a test. Fixed with the
same
import * as Sentry from "@sentry/nextjs"already used elsewhere inthis app (
app/wallet/error.tsx).#1704 —
WalletStatusCardstate coverageOnly an accessibility test existed. Added coverage of: initial load, load
error, provision flow (success and failure), link-challenge flow, and
link-verify (success and failure). Both this new suite and the
pre-existing a11y test needed a
QueryClientProviderwrapper —WalletStatusCardcallsuseQuery/useMutation, which throw without one,and the a11y test's bare
render()call had neither a provider nor acorrect prop (it was passing
accessToken, which the component doesn'taccept — auth comes from
useSessionStore). Fixed both alongside addingthe real coverage.
#1706 — Playwright e2e
CI already runs a "Frontend E2E" job and
playwright.config.tsalreadypointed
testDirat./e2e, but that directory never existed — the jobwas green purely because
test:e2euses--pass-with-no-tests, silentlyrunning zero tests on every PR. Added
e2e/wallet.spec.tscovering walletload + provisioning (mocked backend via
page.route(), a fakeaccessTokencookie past the auth middleware) plus a load-error case, anda
webServerblock inplaywright.config.tsso the Next dev serverstarts itself for both local runs and CI.
#1707 — escrow contract happy-path tests
Chains
create -> get_status=Locked -> release -> get_status=Released,and the equivalent refund path, using
soroban-sdk's testutils.Tests / verification
wallet-api.test.ts,wallet-status-card.test.tsx,wallet-status-card.a11y.test.tsx,e2e/wallet.spec.ts— all new/fixed, verified by careful manual review against this repo's existing test conventions. Could not runvitest/playwrightlocally — this sandbox's npm registry connectivity was severely degraded across this whole PR set (a dozen-plus install attempts, every kind of failure fromECONNRESETto Windows file-lock races to genuine multi-minute stalls).payment_escrow's new tests: partially verified.cargo test -p payment_escrowinitially failed to compilesoroban-sdk's owntestutils.rsat all ("cannot find crateserde_json/rand") — traced this tocontracts/.cargo/config.tomlpinning[build] target = "wasm32-unknown-unknown"as the default for every cargo invocation includingtest, andrand's OS-entropy code isn't available on bare wasm32. Runningcargo test --target x86_64-pc-windows-msvcgets past that and compiles most of the dependency graph, but then hits a genuine version conflict insidesoroban-env-host 21.2.1itself (ChaCha20Rngdoesn't satisfy theCryptoRngbounded25519-dalekexpects — two different major versions ofed25519-dalekcoexist in this workspace'sCargo.lock). That's an upstream dependency-graph issue unrelated to this file's code, and out of scope to fix here — re-resolving/pinning versions workspace-wide isn't something four test-coverage issues should carry. I'm confident in the tests from manual review againstsoroban-sdk21.x's documented testutils API, but flagging this for CI/reviewer attention since I couldn't get a passing local run.Closes
Closes #1704
Closes #1705
Closes #1706
Closes #1707