test/fix(sms): scope S8 Type-column assertion + S9 RetryDelay display (review polish)

This commit is contained in:
Joseph Doherty
2026-06-19 11:00:06 -04:00
parent 4860aeff62
commit 78fadb82d2
2 changed files with 14 additions and 4 deletions
@@ -61,7 +61,7 @@
<div class="col-md-4 text-muted">Max Retries</div>
<div class="col-md-8">@sms.MaxRetries</div>
<div class="col-md-4 text-muted">Retry Delay</div>
<div class="col-md-8">@sms.RetryDelay</div>
<div class="col-md-8">@((int)sms.RetryDelay.TotalSeconds) s</div>
</div>
</div>
</div>
@@ -127,12 +127,15 @@ public class NotificationListsPageTests : BunitContext
[Fact]
public void RendersTypeColumn_Email()
{
// The list name deliberately contains no channel word so that the only "Email"
// in the rendered markup originates from the Type column cell, not the name cell.
// This guards against false-passes where the name itself satisfies the assertion.
var repo = Substitute.For<INotificationRepository>();
repo.GetAllNotificationListsAsync()
.Returns(Task.FromResult<IReadOnlyList<NotificationList>>(
new List<NotificationList>
{
new("Email Alerts") { Id = 3, Type = NotificationType.Email }
new("Ops Alerts") { Id = 3, Type = NotificationType.Email }
}));
repo.GetRecipientsByListIdAsync(3)
.Returns(Task.FromResult<IReadOnlyList<NotificationRecipient>>(
@@ -144,8 +147,15 @@ public class NotificationListsPageTests : BunitContext
cut.WaitForAssertion(() =>
{
Assert.Contains("Email Alerts", cut.Markup);
Assert.Contains("Email", cut.Markup);
// Verify the row name rendered.
Assert.Contains("Ops Alerts", cut.Markup);
// Locate the Type <td> in the rendered table row and assert its text content
// is exactly "Email". If the Type column were removed the <td> would not
// exist and the assertion would throw, catching the regression.
var typeCell = cut.FindAll("tbody tr td")
.FirstOrDefault(td => td.TextContent.Trim() == "Email");
Assert.NotNull(typeCell);
});
}