Repository navigation
Description
Problem
A sweep of the shippable packages (core, lab, charts, vega) found that functional test coverage is uneven: core is well-covered, but the visualization packages are almost entirely untested, and a cluster of core hooks have no direct tests.
"Functional" here = a test that renders + asserts, drives interaction (fireEvent/userEvent), queries the DOM (getByRole etc.), or exercises a hook via renderHook — not type-only, snapshot-only, or codemod string-match tests.
Findings (public exports)
| Package | Components func-tested | Hooks func-tested |
|---|---|---|
core |
161 / 173 (93%) | 44 / 64 (69%) |
lab |
16 / 52 (31%) | 1 / 2 |
charts |
0 / 6 (0%) | 0 / 1 |
vega |
0 / 1 (0%) | — |
Total gap: ~55 components + ~22 hooks with no functional test.
1. Visualization packages are the biggest hole (lab charts, charts, vega)
The only viz tests today cover pure-math helpers (color scales, projection, range) plus one SankeyChart render. Every actual chart-primitive component renders nothing under test — all Chart*, Radial*, ThreeD*, Sankey{Grid,Label,Link}, SVGIcon in lab; the whole charts primitive set (ChartAxis/Grid/Legend/Swatch/Tooltip); and VegaChart.
2. Core hooks lack direct tests (logic-heavy, high value)
20 exported core hooks have no dedicated test. Many run indirectly when their parent component renders (e.g. useTooltip via Tooltip.test.tsx), but none isolate the hook's own logic/edge cases via renderHook. Examples: useTooltip, useHoverCard, useLightbox, useCollapsible, useScrollLock, useScrollOverflow, useTruncation, useTranslator, the three useCalendar* hooks, useTableFilterState.
3. A handful of core components have zero tests
ChatComposerDrawer, ChatSendButton, CommandPaletteEmpty, InputClearButton, MobileNavToggle, PowerSearchFilterEditor, PowerSearchToken, TableHeaderCell, TypeaheadItem.
Relationship to #4163
Complementary, not overlapping. #4163 (contract testing & drift prevention) guarantees the written contract (props/types/theming) stays in sync with code, and notes core already has good raw coverage. This issue is about the raw functional-coverage gap in the areas #4163 doesn't reach — primarily the viz packages (0%) and untested hooks.
Proposed approach
- Core hooks first — fast wins:
renderHooktests isolating each hook's logic and edge cases. - Viz smoke harness — a shared render-smoke suite for chart primitives (biggest count, currently 0%), then grow into behavior tests.
- Zero-test core components — colocated
.test.tsxfollowing the existing create-component convention.
Full machine-readable inventory (every component/hook with a func-tested flag) is available and can be attached.
Activity
test: route charts/vega into the ui vitest project and cover the unte…