test(central-ui): cover the per-site KPI error path on the Notification KPIs page

This commit is contained in:
Joseph Doherty
2026-05-19 06:14:19 -04:00
parent 22bac058dd
commit 8bb860ad5f

View File

@@ -113,6 +113,24 @@ public class NotificationKpisPageTests : BunitContext
cut.WaitForAssertion(() => Assert.Contains("kpi down", cut.Markup));
}
[Fact]
public void ShowsPerSiteError_WhenPerSiteKpiQueryFails()
{
// Only the per-site path errors — the global KPI reply stays successful.
_perSiteReply = new PerSiteNotificationKpiResponse(
"p", false, "per-site down", new List<SiteNotificationKpiSnapshot>());
var cut = Render<NotificationKpisPage>();
cut.WaitForAssertion(() =>
{
Assert.Contains("Per-site KPIs unavailable: per-site down", cut.Markup);
// The two error paths are isolated — the global KPI alert (whose markup
// opens ">KPIs unavailable:", without the "Per-site " prefix) must not appear.
Assert.DoesNotContain(">KPIs unavailable:", cut.Markup);
});
}
[Fact]
public void ShowsPerSiteEmptyState_WhenNoSites()
{