Skip to content

Establish test infrastructure and CI coverage for money/wallet-critical logic #22

Closed

Description

@chonilius

Problem

This repo has zero test infrastructure — no test runner, no test files, and no test script in package.json (only dev, build, start, lint). For a financial application dealing with escrow-adjacent wallet signing, decimal money handling, and multi-step async claim/fund flows (see the other issues in this batch), shipping changes with no automated regression safety net is a significant, compounding risk: every future bug fix (including fixes for the other 29 issues filed alongside this one) is unverifiable except by manual clicking, and regressions in adapters.ts's numeric coercion or wallet.ts's error handling will not be caught before reaching production.

Why this is hard

  • This isn't "add Jest and call it done" — Next.js 16 with Turbopack and React 19 has specific, still-evolving compatibility requirements for test runners (Vitest is generally the better-supported choice for Turbopack-based Next.js projects currently, but this needs verifying against the actual pinned next/react versions in package.json, not assumed).
  • Needs a real strategy split: pure-function unit tests (src/lib/adapters.ts, src/lib/utils.ts, src/lib/wallet.ts's non-extension-dependent logic) are straightforward: component tests for Client Components that depend on @stellar/freighter-api (a browser extension API with no natural test double) require building a mock for the Freighter API surface: and Server Component data-fetching logic (the fetchX functions with mock fallback) needs a strategy for mocking fetch at the right layer without becoming brittle.
  • Must establish a coverage baseline and CI wiring (.github/ exists — check if there's already a workflow to extend or if one needs to be created) so tests actually run on every PR, not just exist locally, and must decide a realistic initial coverage target given the codebase's current size rather than an arbitrary "100%" that stalls the effort.
  • Should specifically prioritize writing tests for the highest-risk logic identified elsewhere (decimal/money handling, team-split validation, wallet network-mismatch handling) rather than starting with trivial UI snapshot tests that provide little real protection — this requires judgment about what's actually risky in this specific codebase, not boilerplate test scaffolding.

Scope

  • Choose and set up a test runner compatible with the pinned Next.js 16/React 19/Turbopack versions; add the test script to package.json.
  • Build a reusable mock for @stellar/freighter-api's functions used in wallet.ts/WalletContext.tsx.
  • Write unit tests for all functions in src/lib/adapters.ts and src/lib/utils.ts, covering the edge cases identified in the numeric-precision and team-split-validation issues in this batch.
  • Write tests for wallet.ts's connect/sign error paths using the mock.
  • Wire test execution into CI (extend existing GitHub Actions workflow under .github/ or add one if none exists) so it runs on every PR.
  • Document the testing approach and coverage baseline in the PR description.

Acceptance criteria

  • npm test runs and passes locally and in CI on every PR.
  • src/lib/adapters.ts and src/lib/wallet.ts have meaningful coverage of both happy paths and the edge/error cases identified in this issue batch.
  • CI fails a PR that breaks an existing test.

Activity

  1. added
    very hard
    testing
    help wanted
    on Jul 15, 2026
  2. added
    GrantFox OSS
    Maybe Rewarded
    Official Campaign | FWC26
    on Jul 15, 2026
  3. added
    Stellar Wave
    on Aug 25, 2026
  4. AYOMI-cmd commented on Aug 25, 2026

    @AYOMI-cmd

    @AYOMI-cmd has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Please assign this issue to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @AYOMI-cmd to this issue.

  5. stephaniepez21-art commented on Aug 25, 2026

    @stephaniepez21-art

    @stephaniepez21-art has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    hello maintainer i'll love to work on this pls assign.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @stephaniepez21-art to this issue.

  6. luciachizaram commented on Aug 25, 2026

    @luciachizaram
    Contributor

    @luciachizaram has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Please assign this issue to me

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @luciachizaram to this issue.

  7. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @luciachizaram! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @luciachizaram: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  8. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @luciachizaram as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @luciachizaram: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  9. removed
    Stellar Wave
    on Oct 15, 2026
  10. added
    Stellar Wave
    on Oct 15, 2026
  11. removed
    Stellar Wave
    on Oct 15, 2026
  12. added
    Stellar Wave
    on Oct 15, 2026
  13. removed
    Stellar Wave
    on Oct 15, 2026
  14. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSMaybe RewardedOfficial Campaign | FWC26Stellar Wavehelp wantedtestingvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions