test(viewer): add dashboard and episode-viewer component tests#595
test(viewer): add dashboard and episode-viewer component tests#595WilliamBerryiii wants to merge 4 commits intomainfrom
Conversation
…codecov flags
- add Radix DOM shims (typed Observers) and test-utils QueryClient helpers
- split codecov vitest into vitest-{components,features,lib,state,app}
- multi-flag workflow upload; refresh copilot-instructions L448
- drop main.tsx from vitest-app; add StarRating/ProgressOverview proof tests
🧪 - Generated by Copilot
…ent tests - add 5 dashboard component tests (ActivityFeed, AnnotatorLeaderboard, IssuesSummary, QualityDashboard, RatingDistribution) - add DataviewerEpisodeViewer shell test and ViewerDisplayControls test - disable vitest globals and wire jest-dom + cleanup in test/setup.ts - closes #219 🧪 - Generated by Copilot
- add tests for CameraSelector, JointSelector, JointConfigDefaultsEditor - add tests for PlaybackControls, Timeline, TrajectoryPlot, VideoPlayer - add tests for joint-constants and trajectory-plot-utils helpers - add aria-labels to PlaybackControls icon buttons for accessibility closes #218 🧪 - Generated by Copilot
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #595 +/- ##
==========================================
+ Coverage 65.16% 68.95% +3.79%
==========================================
Files 251 263 +12
Lines 15597 16812 +1215
Branches 2193 2302 +109
==========================================
+ Hits 10164 11593 +1429
+ Misses 5142 4925 -217
- Partials 291 294 +3
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
katriendg
left a comment
There was a problem hiding this comment.
✅ Approved — Solid test coverage addition
98 new tests across 16 files with no regressions detected. The globals: false change is safe (all existing tests already import explicitly from vitest), aria-label additions improve both testability and accessibility, and the Response-based mock refactors are a strict improvement.
💡 Minor items — address at your discretion
These are all non-blocking style observations; feel free to ignore or address in follow-up:
1. Redundant cleanup() calls
setup.ts now registers a global afterEach(() => { cleanup() }), but 6 test files (StarRating, ActivityFeed, AnnotatorLeaderboard, IssuesSummary, ProgressOverview, QualityDashboard, RatingDistribution) still call cleanup() in their own afterEach. Harmless duplication — could remove the per-file ones for consistency.
2. Fragile CSS-class selectors
A few tests query by Tailwind utility classes (.animate-pulse, .font-medium, span.truncate.font-medium). These will break silently if class names change. Prefer role, aria-label, or data-testid where possible.
3. as never type casts on store mocks
Timeline.test.tsx, VideoPlayer.test.tsx, and TrajectoryPlot.test.tsx use as never to silence type mismatches on mock returns. A more precise cast (e.g., as ReturnType<typeof usePlaybackControls>) would preserve compile-time validation.
4. jsonResponse duplication
test-utils.tsx exports a nice jsonResponse helper, but api-client.test.ts and use-joint-config.test.ts maintain their own local versions. Could consolidate to one source.
5. Non-null assertion after expect guard (Timeline.test.tsx ~L183)
expect(playhead).not.toBeNull()
expect(playhead!.style.left).toBe('50%')An if (playhead) narrowing or optional chaining would be more idiomatic TypeScript.
None of the above affect correctness or test reliability. Nice work on the coverage push! 🎉
Description
Adds Vitest + React Testing Library coverage for the dataviewer frontend. Two stacked commits land together in this PR:
5ac1235— vitest/happy-dom test infrastructure plus dashboard, app-shell, and viewer-display component tests (33 tests across 5 files, plusViewerDisplayControls). Closes test(dataviewer): add tests for dashboard components #219.1f6a15e— episode-viewer component tests (65 tests across 9 files), plus minorPlaybackControlsaria-label additions to make controls testable. Closes #218A.Total new coverage: 98 tests / 16 test files. Combined suite: 813/813 passing.
Closes #219
Closes #218A
Type of Change
Component(s) Affected
infrastructure/— Terraform, AKS, networkingworkflows/— GitHub Actions CI/CDtraining/— RL/IL training codedocs/— Documentationdata-management/viewer/frontend(test infrastructure + component tests)Testing Performed
Test command:
Result: 81 test files / 813 tests passed in 28.64s ·
tscclean · 0 lint errors / 39 pre-existing warnings.Documentation Impact
Checklist