test(sms): regression tests for code-review fixes
Lock the behaviors changed by the review-fix commit + the security invariants: - ManagementActorTests: UpdateSms/SmtpConfig now require Administrator (updated the existing success cases from Designer); + UpdateSmsConfig_WithDesignerRole_Returns Unauthorized and _WithEmptyAuthToken_PreservesExistingToken regression tests. - SecretEncryptionTests: SmsConfiguration.AuthToken stored-encrypted round-trip + null round-trip (AccountSid stays plaintext) — guards ApplySecretColumnEncryption. - ArtifactDiffTests: CompareSmsConfiguration New/Identical/Modified + the secret presence-only invariant (value never echoed, presence-flip shows <present> only). - UpdateCommandContractTests: notification sms update core fields Required, --auth-token optional. - NotificationListsPageTests: SMS recipient badge shows phone, not "Name <>". - NotificationOutboxActorDispatchTests: SMS-typed notification routes to the SMS adapter (StubAdapter.Type made configurable), not the Email adapter. - NotificationRecipientTests (new): ForEmail/ForSms + public-ctor invariants.
This commit is contained in:
@@ -124,6 +124,35 @@ public class NotificationListsPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SmsListRecipientBadge_ShowsPhoneNumber_NotEmptyAngleBrackets()
|
||||
{
|
||||
// CentralUI-NNN regression: an SMS recipient carries a PhoneNumber and a null
|
||||
// EmailAddress. The badge must render the phone, not the email-shaped "Name <>".
|
||||
var repo = Substitute.For<INotificationRepository>();
|
||||
repo.GetAllNotificationListsAsync()
|
||||
.Returns(Task.FromResult<IReadOnlyList<NotificationList>>(
|
||||
new List<NotificationList>
|
||||
{
|
||||
new("SMS Alerts") { Id = 7, Type = NotificationType.Sms }
|
||||
}));
|
||||
repo.GetRecipientsByListIdAsync(7)
|
||||
.Returns(Task.FromResult<IReadOnlyList<NotificationRecipient>>(
|
||||
new List<NotificationRecipient> { NotificationRecipient.ForSms("Jane", "+15551234567") }));
|
||||
Services.AddSingleton(repo);
|
||||
WireAuthAndDialog();
|
||||
|
||||
var cut = Render<NotificationListsPage>();
|
||||
|
||||
cut.WaitForAssertion(() =>
|
||||
{
|
||||
Assert.Contains("+15551234567", cut.Markup);
|
||||
// The bug rendered an empty contact field ("Jane <>") for SMS recipients.
|
||||
Assert.DoesNotContain("Jane <>", cut.Markup);
|
||||
Assert.DoesNotContain("Jane <>", cut.Markup);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RendersTypeColumn_Email()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user