---
id: w3/m4.5/t006
title: "Test coverage — meaningful tests for the charts, limit labels, filters, and range presets"
worker: worker3
status: done
estimate: 30m
depends_on: [w3/m4.5/t001, w3/m4.5/t002, w3/m4.5/t003, w3/m4.5/t004]
---

## Objective

Add tests that assert the real behavior this milestone ships and its failure modes — no tautological or snapshot-everything tests.

## Context

- Existing patterns: the m3 dashboard tests mock the GraphQL layer around `use-metrics.ts`.
- Behaviors worth pinning: multi-point series render a chart while a single point / empty series falls back to the stat / empty state; limit label hidden when no `*_LIMIT` series; statusCode/groupBy propagate into the GraphQL variables and grouped responses render one series per label; each range preset maps to its expected resolution.

## Steps

1. Component tests for the application-metrics card: stepped series ⇒ chart; empty percentage series ⇒ honest empty state; limit label shown/hidden.
2. Hook/query tests: statusCode + groupBy variables; preset→resolution mapping.
3. Grouped bar rendering: N labeled series ⇒ N legend entries.

## Files

- `dashboard/src/features/metrics/**` (test files alongside components/hooks)

## Acceptance criteria

- [ ] Each shipped behavior above has a test that fails if it regresses.
- [ ] Dashboard test suite green.

## Out of scope

- Backend tests (covered in w3/m4) and e2e browser suites.
