Skip to content

test(frontend): add vitest suite mirroring backend coverage#139

Draft
xishell wants to merge 2 commits into
mainfrom
feat/frontend-test-suite
Draft

test(frontend): add vitest suite mirroring backend coverage#139
xishell wants to merge 2 commits into
mainfrom
feat/frontend-test-suite

Conversation

@xishell

@xishell xishell commented May 5, 2026

Copy link
Copy Markdown
Member

Summary

Brings the frontend up to backend test parity: a Vitest suite with shared fixtures, factories, and a coverage gate at 80%, plus a CI job that posts the coverage report on every PR.

Changes

  • Add Vitest suite under src/**/__tests__/: 117 tests across pages,
    components, hooks, and lib helpers. Mirrors the backend layout where
    every router has a test_*_api.py.
  • New shared fixtures in src/test/, setup.ts (jsdom + in-memory
    Web Storage shim that survives node 22's experimental localStorage),
    helpers.tsx (renderWithAuthLayout, mockFetch, factories), and
    eventSource.ts (FakeEventSource for SSE-driven hooks).
  • Wire @vitest/coverage-v8 with thresholds lines/statements/functions = 80,
    branches = 75. Local: bun run test:cov.
  • Add frontend-vitest job in .github/workflows/test.yml using
    davelosert/vitest-coverage-report-action, posting a coverage comment
    on PRs and a step summary on every run.

Checklist

  • Code compiles/builds without errors or warnings
  • Code follows the project style guide and has been formatted
  • All existing tests pass
  • New functionality includes appropriate tests
  • PR title follows Conventional Commits format

@xishell xishell self-assigned this May 5, 2026
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Coverage Report for Frontend coverage (frontend)

Status Category Percentage Covered / Total
🔵 Lines 91.25% (🎯 80%) 584 / 640
🔵 Statements 88.48% (🎯 80%) 630 / 712
🔵 Functions 86.09% (🎯 80%) 161 / 187
🔵 Branches 78.97% (🎯 75%) 387 / 490
File CoverageNo changed files found.
Generated in workflow #208 for commit 1c46087 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

Coverage

Backend coverage
FileStmtsMissCoverMissing
app
   __init__.py10100% 
   auth.py26292%40–41
   broadcaster.py23291%18–19
   config.py190100% 
   db.py15473%20, 31, 35–36
   dependencies.py130100% 
   events.py74396%62–63, 71
   logging_config.py914353%17, 24–27, 32–33, 38–47, 58–61, 78–130
   main.py932870%77–81, 86–97, 107–116, 170–180
   models.py1280100% 
   mqtt.py1516855%36, 40–48, 117–118, 158–183, 199–206, 218–231, 236–273
   notifications.py25196%52
   schemas.py1580100% 
app/adoption
   __init__.py00100% 
   claims.py360100% 
   finalize.py49198%101
   sweeper.py311165%41–51
app/routers
   adoptions.py1001684%35–36, 171–184
   auth.py41198%68
   berths.py731382%34, 61–72, 160
   docks.py221150%22–26, 36–46
   gateways.py180100% 
   harbors.py110100% 
   nodes.py71297%74, 79
   users.py53198%87
TOTAL132220784% 

Tests Skipped Failures Errors Time
156 0 0 0 11.170s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant