Skip to content

Write a frontend testing guide covering Vitest, RTL, and happy-dom conventions #658

Description

@1nonlypiece

📌 Description

The project uses Vitest, React Testing Library, happy-dom, and v8 coverage, but
there is no guide documenting how to write tests, mock fetch/Freighter, use
fake timers, or run coverage. Contributors writing the many new test files in
this campaign need a consistent reference.

This issue adds a frontend testing guide capturing the project's conventions and
common mocking patterns.

🎯 Requirements and Context

  • Document running tests (pnpm test, test:watch, test:coverage) and the
    coverage threshold expectation.
  • Show patterns: mocking fetch, mocking @stellar/freighter-api, fake timers,
    and RTL queries/accessibility-first assertions.
  • Document conventions for __tests__ placement and naming.
  • Provide a copy-paste component-test and route-test template.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b docs/frontend-testing-guide

2. Implement changes

  • Add docs/TESTING_GUIDE.md; cross-link from README.md and DEVELOPER_GUIDE.md.
  • Add src/lib/__tests__/testingGuideExamples.test.ts that runs the guide's
    example snippets so they cannot rot.
  • Validate the example tests pass under the real test runner.

3. Test and commit

  • Run pnpm test.
  • Cover edge cases: ensure example mocks (fetch/Freighter/timers) actually work.

Example commit message

docs: frontend testing guide with Vitest/RTL conventions

✅ Guidelines

  • Minimum 95% test coverage on example helpers.
  • Clear, reviewer-friendly documentation.
  • Timeframe: 96 hours.

🏷️ Labels

type-documentation · area-frontend · MAYBE REWARDED · GRANTFOX OSS ·
OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the CommitLabs contributor Discord to coordinate and get unblocked fast:
    https://discord.gg/WV7tdYkJk
  • Introduce yourself before starting so we can avoid duplicate work and pair you
    with a reviewer. Maintainers triage actively and review fast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions