feat(kpihistory): add 30d/90d trend windows to Audit/SiteCalls/Notifications/Health (plan #22 T7)

Adds 30d (720h) and 90d (2160h) toggle buttons alongside the existing
24h/7d controls on all four KPI trend surfaces. No fetch-logic changes:
the setters already recompute fromUtc and re-fetch, and the query service
(T5) transparently routes windows > RollupThresholdHours to hourly rollups
— so these windows are what actually exercise the rollup path. bUnit tests
extend the Audit and SiteCalls trend harnesses to cover the new buttons.

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-10 12:12:17 -04:00
parent bedf3c55f0
commit bbfc1b3278
6 changed files with 91 additions and 0 deletions
@@ -590,6 +590,31 @@ public class SiteCallsReportPageTests : BunitContext
Assert.True(_kpiHistory.ReceivedCalls().Count() > afterExpand));
}
[Fact]
public void TrendsSection_LongRangeWindows_RenderAndReloadSeries()
{
// The 30d/90d buttons (plan #22 T7) render alongside 24h/7d and clicking
// one re-loads the series — the query service then routes the long window
// to hourly rollups transparently.
var cut = Render<SiteCallsReportPage>();
cut.WaitForState(() => cut.Markup.Contains("ERP.GetOrder"));
cut.Find("[data-test='site-calls-trends-toggle']").Click();
cut.WaitForAssertion(() => Assert.NotEmpty(cut.FindAll("[data-test^='kpi-trend-']")));
// Both long-range buttons are present in the toggle group.
Assert.Contains(cut.FindAll("button"), b => b.TextContent.Trim() == "30d");
Assert.Contains(cut.FindAll("button"), b => b.TextContent.Trim() == "90d");
var afterExpand = _kpiHistory.ReceivedCalls().Count();
// Switch the window to 90d — the series re-load (another batch of calls).
cut.FindAll("button").First(b => b.TextContent.Trim() == "90d").Click();
cut.WaitForAssertion(() =>
Assert.True(_kpiHistory.ReceivedCalls().Count() > afterExpand));
}
[Fact]
public void TrendsSection_WhenKpiHistoryThrows_PageStillRenders()
{