fix(profiles): connection-profile switch re-dials the WebSocket (#888)

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57
2026-08-12 23:27:08 +03:00
committed by GitHub
co-authored by M57
parent 546bd17b18
commit 683a24becf
10 changed files with 183 additions and 17 deletions
@@ -141,6 +141,32 @@ class AuthManagerTest {
assertEquals(9090, AuthManager.getPort())
}
@Test
fun testSetSelectedProfileId_refreshesBaseUrlFlow() {
AuthManager.ensureDefaultProfile()
AuthManager.setBaseUrl("http://10.0.0.1:9119/")
AuthManager.saveConnectionProfiles(
listOf(
ConnectionProfile(
id = AuthManager.DEFAULT_PROFILE_ID,
name = "Default",
baseUrl = "http://10.0.0.1:9119/",
),
ConnectionProfile(
id = "prof-2",
name = "Home",
baseUrl = "http://10.0.0.2:9220/",
),
),
)
AuthManager.setSelectedProfileId("prof-2")
// contextFlow consumers must see the NEW server's URL after a
// connection-profile switch, not the previous one (split-brain fix).
assertEquals("http://10.0.0.2:9220/", AuthManager.baseUrlFlow.value)
}
@Test
fun testGetAndSetAutoReconnect() {
AuthManager.setAutoReconnect(false)