From a8192515cee6f1f141cc0c0a9a524bf609e00e89 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 19:45:26 +0000 Subject: [PATCH] Tests: the SIP line's new menu label; anonymous SIP's settings and SIP addresses Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRSJKSd2kxxKFZAiaXQ --- .../app/android/settings/ModemSettingsTest.kt | 22 +++++++++++++++++++ .../dmodem/app/android/ui/PeerShotsTest.kt | 6 ++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/src/test/java/org/dmodem/app/android/settings/ModemSettingsTest.kt b/app/src/test/java/org/dmodem/app/android/settings/ModemSettingsTest.kt index e123561..b7ebd57 100644 --- a/app/src/test/java/org/dmodem/app/android/settings/ModemSettingsTest.kt +++ b/app/src/test/java/org/dmodem/app/android/settings/ModemSettingsTest.kt @@ -30,6 +30,28 @@ class ModemSettingsTest { assertTrue(ModemSettings(user = "u", domain = "h").complete) } + /** anonymous SIP: complete with no account, the engine given none (the account kept), said so */ + @Test + fun anonymousSipNeedsNoAccount() { + val s = ModemSettings(anonymous = true) + assertTrue(s.complete) + assertTrue(s.sip) + assertEquals(Triple("", "", ""), s.sipAccount) + val kept = ModemSettings(user = "u", password = "p", domain = "h", anonymous = true) + assertEquals(Triple("", "", ""), kept.sipAccount) + assertEquals(Triple("u", "p", "h"), kept.copy(anonymous = false).sipAccount) + assertTrue(s.sipSummary.startsWith("anonymous")) + assertEquals("u@h", kept.copy(anonymous = false).sipSummary) + } + + /** a SIP address as D-Modem dials it: sip: before it when it has no scheme */ + @Test + fun sipAddressesGetTheirScheme() { + assertEquals("sip:bbs@example.com", org.dmodem.app.android.ui.sipAddress(" bbs@example.com ")) + assertEquals("sip:bbs@example.com", org.dmodem.app.android.ui.sipAddress("sip:bbs@example.com")) + assertEquals("SIPS:bbs@example.com", org.dmodem.app.android.ui.sipAddress("SIPS:bbs@example.com")) + } + /** a USB modem needs no SIP account and is no peer line; the other lines as they were */ @Test fun aUsbModemNeedsNoAccountAndIsNoPeer() { diff --git a/app/src/test/java/org/dmodem/app/android/ui/PeerShotsTest.kt b/app/src/test/java/org/dmodem/app/android/ui/PeerShotsTest.kt index e62cb6d..951f4fa 100644 --- a/app/src/test/java/org/dmodem/app/android/ui/PeerShotsTest.kt +++ b/app/src/test/java/org/dmodem/app/android/ui/PeerShotsTest.kt @@ -64,7 +64,7 @@ class PeerShotsTest { save(ModemSettings(line = ModemSettings.LINE_SIP)) SettingsNav.open(SettingsPage.LINE) compose.onNodeWithText("Settings").performClick() - compose.onNodeWithText("A SIP account (calls over the internet)").performScrollTo().performClick() + compose.onNodeWithText("SIP: an account, or anonymous (calls over the internet)").performScrollTo().performClick() compose.onNodeWithText("Another phone with D-Modem, on Wi-Fi").performClick() compose.onNodeWithText("Find phones on this network").performScrollTo().assertExists() shot("peer-0-line-menu") @@ -78,7 +78,7 @@ class PeerShotsTest { compose.onNodeWithText("Settings").performClick() // (under More: the Wi-Fi / Cell lines' menu hasn't it) compose.onNodeWithText("More").performClick() - compose.onNodeWithText("A SIP account (calls over the internet)").performScrollTo().performClick() + compose.onNodeWithText("SIP: an account, or anonymous (calls over the internet)").performScrollTo().performClick() compose.onNodeWithText("No line (the modem on its own)").performClick() compose.onNodeWithText("a dial gets NO DIALTONE", substring = true).assertExists() // (no SIP account asked for) @@ -92,7 +92,7 @@ class PeerShotsTest { save(ModemSettings(line = ModemSettings.LINE_SIP)) SettingsNav.open(SettingsPage.LINE) compose.onNodeWithText("Settings").performClick() - compose.onNodeWithText("A SIP account (calls over the internet)").performScrollTo().performClick() + compose.onNodeWithText("SIP: an account, or anonymous (calls over the internet)").performScrollTo().performClick() compose.onNodeWithText("Another phone with D-Modem, on Wi-Fi").assertExists() compose.onNodeWithText("No line (the modem on its own)").assertDoesNotExist() compose.onNodeWithText("A phone line, through a USB modem").assertDoesNotExist()