Skip to content

test: Set up frontend test harness (Vitest) and add first hook tests #241

Description

@aguilar1x

Summary

apps/web-app currently has no test infrastructure at all — there is no test script in package.json and not a single *.test.* / *.spec.* file across src/. This means every hook and utility (including financial calculations) ships unverified, and contributors have no harness to add regression tests to.

This issue sets up the testing foundation and lands the first few high-value tests.

Scope

  1. Add Vitest + React Testing Library (with jsdom) to apps/web-app, wired into the Turborepo test pipeline.
  2. Add a test (and test:watch) script to apps/web-app/package.json.
  3. Write the first unit tests for critical, pure-ish logic:
    • apps/web-app/src/features/borrowing/hooks/useHealthFactor.ts — health-factor math
    • apps/web-app/src/lib/utils.tscn() and any pure helpers
    • One more hook/util of the contributor's choice with clear input/output

Acceptance criteria

  • npm run test (and the Turbo test task) runs Vitest in apps/web-app and passes
  • Vitest + RTL + jsdom configured (vitest.config.ts, setup file)
  • At least 3 meaningful tests covering real behavior (not just "renders without crashing")
  • CI-friendly: tests run headless and deterministically
  • Short note in the README on how to run tests

Notes

Keep the first PR focused on the harness + a small set of exemplary tests so future contributors have a clear pattern to copy. Broad coverage of all 90+ components is explicitly out of scope here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programhelp wantedExtra attention is neededtest

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions