Category: Testing | Priority: High | Dependencies: none | Out of scope: browser/UI component tests (separate issue)
Description & Context: frontend/src/lib/stellar/errors.ts and preflight.ts turn opaque Soroban failures into user guidance, but the frontend has no test framework and no committed tests — they were only smoke-tested ad hoc. A regression silently ships cryptic HostErrors to users.
Acceptance Criteria / DoD:
How to verify: cd frontend && npm test — all green; break one mapping and confirm the suite fails.
Category: Testing | Priority: High | Dependencies: none | Out of scope: browser/UI component tests (separate issue)
Description & Context:
frontend/src/lib/stellar/errors.tsandpreflight.tsturn opaque Soroban failures into user guidance, but the frontend has no test framework and no committed tests — they were only smoke-tested ad hoc. A regression silently ships crypticHostErrors to users.Acceptance Criteria / DoD:
vitestadded tofrontend/package.jsonwith anpm testscript; CI (frontend.yml) runs it on every push and PRerrors.test.tscovers: every contract code 1–20 → mapped message; eachHOST_ERROR_PATTERNScategory (balance, fee, trustline, TTL, auth, contract-missing); Freighter rejection; network error;WalletError/PreflightErrorpass-through; unknown error fallbackpreflight.test.tscovers:runPreflightreturns ALL failures (not fail-fast); everyassert*returnsnullon pass / message on fail; mocked Freighter (isConnected/isAllowed/getAddress) and Horizon/RPC responsesnpm testexits 0 in CIHow to verify:
cd frontend && npm test— all green; break one mapping and confirm the suite fails.