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

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-08-12 23:27:08 +03:00
1 parent 546bd17b18
commit 683a24becf
10 files changed
+183 -17

No files matched your search

@@ -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)