test(notification-outbox): cover Discard and query-failure paths on the Outbox page
This commit is contained in:
@@ -165,6 +165,27 @@ public class NotificationOutboxPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ClickDiscard_OnParkedRow_CallsDiscardNotification()
|
||||
{
|
||||
var cut = Render<NotificationOutboxPage>();
|
||||
|
||||
cut.WaitForState(() => cut.Markup.Contains("Pump fault at Plant-A"));
|
||||
|
||||
var parkedRow = cut.FindAll("tbody tr")
|
||||
.First(r => r.TextContent.Contains("Pump fault at Plant-A"));
|
||||
var discardButton = parkedRow.QuerySelectorAll("button")
|
||||
.First(b => b.TextContent.Contains("Discard"));
|
||||
|
||||
discardButton.Click();
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
Assert.Single(_discardRequests);
|
||||
Assert.Equal("notif-aaaaaaaa-1111", _discardRequests[0].NotificationId);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void KpiFailure_ShowsErrorMessage()
|
||||
{
|
||||
@@ -177,6 +198,19 @@ public class NotificationOutboxPageTests : BunitContext
|
||||
Assert.Contains("outbox repository unavailable", cut.Markup));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void QueryFailure_ShowsErrorMessage()
|
||||
{
|
||||
_queryReply = new NotificationOutboxQueryResponse(
|
||||
"q", false, "outbox query backend unavailable",
|
||||
new List<NotificationSummary>(), TotalCount: 0);
|
||||
|
||||
var cut = Render<NotificationOutboxPage>();
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
Assert.Contains("outbox query backend unavailable", cut.Markup));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
|
||||
Reference in New Issue
Block a user