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() {