Bundle H follow-up: fix Pass 3 test mock shape mismatches caught by CI

CI surfaced two real failures in the Pass 3 tests:

1. ObservabilityPage.test.tsx — tests 2 + 3 mocked getMetrics with only

   the uptime field, but ObservabilityPage.tsx:85 reads metrics.gauge

   .certificate_total. Test 2 silently 'passed' because the page error

   bailed out before any rendering took place — its assertions (no live

   <script>, __xss_pwned__ undefined) became vacuous; test 3 surfaced

   the actual TypeError. Fix: every getMetrics mock now returns the full

   MetricsResponse shape (gauge / counter / uptime) per src/api/types.ts

   :517 — sanity-checked against the actual TS interface.

2. CertificateDetailPage.test.tsx — the xssCert mock was missing

   updated_at, which CertificateDetailPage.tsx:605 reads through

   formatDateTime. formatDateTime tolerates undefined per utils.ts:6,

   so the page didn't throw, but the cert mock should mirror the real

   ManagedCertificate shape — added updated_at.

Both fixes are mock-shape corrections; no production code changes.
This commit is contained in:
Shankar
2026-04-27 03:18:51 +00:00
parent 58cc89f817
commit fe0912c683
2 changed files with 37 additions and 3 deletions
@@ -66,6 +66,7 @@ const xssCert = {
renewal_policy_id: 'rp-xss',
expires_at: new Date(Date.now() + 30 * 86400000).toISOString(),
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
not_before: new Date(Date.now() - 86400000).toISOString(),
not_after: new Date(Date.now() + 30 * 86400000).toISOString(),
serial_number: xssPayload,