Skip to content

Fix dashboard vitest suite and run it in CI - #1160

Open
MaxGhenis wants to merge 1 commit into
mainfrom
fix-dashboard-tests
Open

Fix dashboard vitest suite and run it in CI#1160
MaxGhenis wants to merge 1 commit into
mainfrom
fix-dashboard-tests

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Problem

The dashboard vitest suite was silently broken and never ran:

  • dashboard/src/components/__tests__/Documentation.test.jsx imported ../Documentation and LandingPage.test.jsx imported ../LandingPage — both components were renamed (DocumentationContent.jsx, LandingContent.jsx), so both suites failed on module resolution.
  • No vitest config existed, so even with fixed imports nothing wired up jsdom or the jest-dom setup file.
  • .github/workflows/ci.yml had no dashboard job (only ruff, pytest, and the changelog check), so the breakage sat dormant.

Changes

  • Rename test files to match their components (DocumentationContent.test.jsx, LandingContent.test.jsx) and fix the imports.
  • Update stale assertions: the .doc-intro-blurb class no longer exists (assert the intro text directly); section tabs asserted by button role — Installation & Usage, All Runners & CLI, Variable Mappings, Sample Datasets; "Command-Line Interface" is now sentence-cased ("Command-line interface"). Assertions are presence-style, so they stay green when new tabs land (verified concretely against Add Future Plans & Maintenance docs and public API contract test #1153's diff — see below).
  • New coverage: Sample Datasets Enhanced CPS / HuggingFace links, the async-loaded Variable Mappings search box, and the Installation card's OS toggle (the previous installation assertion was satisfied by the intro blurb alone).
  • Add dashboard/vitest.config.mjs: jsdom environment, setup file, automatic JSX runtime, @ alias matching jsconfig.json.
  • Register testing-library cleanup in src/test/setup.js: vitest runs with globals off, so RTL auto-cleanup never registers; without it, rendered containers leak across tests and interaction tests click stale component instances.
  • Add a dashboard-test CI job: oven-sh/setup-bun@v2, bun install --frozen-lockfile, bun run test in dashboard/. The versioning/publish needs-chain is untouched (the dashboard suite doesn't gate the Python package release).

Note on #1153

#1153 (still open) adds a fifth Maintenance & Roadmap tab to DocumentationContent.jsx. A reviewer agent applied that PR's diff on top of this branch and re-ran the suite: all tests stay green, and there is no textual conflict (this PR doesn't touch DocumentationContent.jsx). Once both merge, #1153 can extend the section-tab test with the fifth label.

Verification

  • cd dashboard && bun run test: 2 files, 16 tests, all passing.
  • ruff format --check . clean; no Python touched.
  • Reviewed by a 4-dimension agent workflow (assertion correctness vs. component markup, vitest/CI config, repo conventions, Add Future Plans & Maintenance docs and public API contract test #1153 forward-compat) with adversarial verification; both confirmed findings (missing RTL cleanup, tautological installation assertion) are fixed in this PR.

🤖 Generated with Claude Code

The dashboard test files imported ../Documentation and ../LandingPage,
components that were renamed to DocumentationContent and LandingContent
(imported by the app router pages), so the suite failed on module
resolution. It also never ran anywhere: no vitest config existed (so
jsdom and the jest-dom setup file were not wired) and CI had no
dashboard job.

- Rename the test files to match the components and fix their imports.
- Update stale assertions: the .doc-intro-blurb class is gone (assert
  the intro text directly), section tabs are asserted by button role
  (Installation & Usage, All Runners & CLI, Variable Mappings, Sample
  Datasets), and "Command-Line Interface" is now sentence-cased.
  Presence-style assertions keep the suite green when new tabs land
  (e.g. Maintenance & Roadmap in #1153).
- Add coverage for the Sample Datasets links and the async-loaded
  Variable Mappings search box.
- Add dashboard/vitest.config.mjs: jsdom environment, jest-dom setup,
  automatic JSX runtime, and the @ alias from jsconfig.json.
- Register testing-library cleanup in src/test/setup.js: vitest runs
  with globals off, so RTL auto-cleanup never registers and rendered
  containers would otherwise leak across tests.
- Add a dashboard-test CI job (bun install --frozen-lockfile + bun run
  test) so the suite actually gates PRs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-taxsim Ready Ready Preview Aug 29, 2026 11:17am

Request Review

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