mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 12:21:31 +00:00
e1ab1db65a
Sprint 5 unified-master-audit closure. Pre-fix the page existed
without a co-located test — the only frontend page missing from the
T-1 sweep that covered the other 30. The audit calls this 'a buyer-
side easy finding' since every other page has tests and one doesn't.
The new test mirrors the CertificatesPage.test.tsx pattern: vi.mock
the api/client surface, render via MemoryRouter so useParams resolves
the URL :id param, drive the query through TanStack's resolver, then
assert observable surfaces.
Five test cases pin:
- Initial render: page header + empty-state banner when the
hierarchy is empty.
- Tree expansion: a flat 3-row root → policy → issuing list renders
as the nested forest the component builds from parent_ca_id.
- Orphan handling: a CA whose parent_ca_id references a missing
row surfaces at the top level (documented fallback in
buildHierarchyTree).
- Error state: when listIntermediateCAs rejects (e.g. RBAC 403
on missing ca.hierarchy.manage), the ErrorState component
renders with the API's error message.
- Missing-id route: when React Router's path doesn't resolve an
id (e.g. '/issuers//hierarchy' collapses), the API is NOT called.
Verified locally: 5/5 pass. The page-coverage ratio at HEAD is now
31/31 — every frontend page has at least one co-located Vitest test.
Closes TEST-007.