From 8bb860ad5fdc9d48207378ae33f03dba64f7e23b Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 19 May 2026 06:14:19 -0400 Subject: [PATCH] test(central-ui): cover the per-site KPI error path on the Notification KPIs page --- .../Pages/NotificationKpisPageTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/ScadaLink.CentralUI.Tests/Pages/NotificationKpisPageTests.cs b/tests/ScadaLink.CentralUI.Tests/Pages/NotificationKpisPageTests.cs index c19aa5e..d390d7d 100644 --- a/tests/ScadaLink.CentralUI.Tests/Pages/NotificationKpisPageTests.cs +++ b/tests/ScadaLink.CentralUI.Tests/Pages/NotificationKpisPageTests.cs @@ -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()); + + var cut = Render(); + + 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() {