Skip to content

Functional test coverage gaps: viz packages (charts/vega/lab) at ~0%, plus untested core hooks #4295

Open

Description

@humbertovirtudes

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

  1. Core hooks first — fast wins: renderHook tests isolating each hook's logic and edge cases.
  2. Viz smoke harness — a shared render-smoke suite for chart primitives (biggest count, currently 0%), then grow into behavior tests.
  3. Zero-test core components — colocated .test.tsx following the existing create-component convention.

Full machine-readable inventory (every component/hook with a func-tested flag) is available and can be attached.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions