Skip to content

test: WalletStatusCard state coverage, wallet-api tests, e2e, escrow contract tests - #1747

Merged
yusuftomilola merged 5 commits into
DistinctCodes:mainfrom
A6dulmalik:feat/1704-1705-1706-1707-test-coverage
Aug 31, 2026
Merged

test: WalletStatusCard state coverage, wallet-api tests, e2e, escrow contract tests#1747
yusuftomilola merged 5 commits into
DistinctCodes:mainfrom
A6dulmalik:feat/1704-1705-1706-1707-test-coverage

Conversation

@A6dulmalik

Copy link
Copy Markdown
Contributor

Summary

Four test-coverage fixes across the frontend and the escrow contract:

#1705wallet-api.ts tests
Added tests for every exported function's success path and walletFetch's
non-ok error path (JSON error body with/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. Fixed with the
same import * as Sentry from "@sentry/nextjs" already used elsewhere in
this app (app/wallet/error.tsx).

#1704WalletStatusCard state coverage
Only 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 QueryClientProvider wrapper —
WalletStatusCard calls useQuery/useMutation, which throw without one,
and the a11y test's bare render() call had neither a provider nor a
correct prop (it was passing accessToken, which the component doesn't
accept — auth comes from useSessionStore). Fixed both alongside adding
the real coverage.

#1706 — Playwright e2e
CI already runs a "Frontend E2E" job and playwright.config.ts already
pointed testDir at ./e2e, but that directory never existed — the job
was green purely because test:e2e uses --pass-with-no-tests, silently
running zero tests on every PR. Added e2e/wallet.spec.ts covering wallet
load + provisioning (mocked backend via page.route(), a fake
accessToken cookie past the auth middleware) plus a load-error case, and
a webServer block in playwright.config.ts so the Next dev server
starts 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 run vitest/playwright locally — this sandbox's npm registry connectivity was severely degraded across this whole PR set (a dozen-plus install attempts, every kind of failure from ECONNRESET to Windows file-lock races to genuine multi-minute stalls).
  • payment_escrow's new tests: partially verified. cargo test -p payment_escrow initially failed to compile soroban-sdk's own testutils.rs at all ("cannot find crate serde_json/rand") — traced this to 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. Running 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 — re-resolving/pinning versions workspace-wide isn't something four test-coverage issues should carry. I'm confident in the tests from manual review against soroban-sdk 21.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

…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
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@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.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No merge conflicts with main. Good test coverage additions for WalletStatusCard state handling, wallet-api, the e2e suite, and the escrow contract - approving.

@yusuftomilola
yusuftomilola merged commit a2d3b07 into DistinctCodes:main Aug 31, 2026
1 of 7 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

2 participants