Add comprehensive tests for ServerCollectionOps (#696)

* Test ServerCollectionOps data manipulation utilities

Added comprehensive unit tests for `ServerCollectionOps.kt` to cover all scenarios for `addOrUpdate`, `selfHealed`, and resolution properties (`resolvedBaseUrl`, `resolvedHost`, `resolvedPort`). Also updated the function name `addOrReplaceServer` to `addOrUpdate` to match the intended signature in the issue description, and updated affected call sites.

* Fix ktlint formatting issues and ensure build succeeds

Fixed ktlint errors in `ServerCollectionOpsTest.kt` by correctly formatting arguments and expressions to comply with project style guidelines. Ran `assembleDebug` and tests locally to verify build health.
This commit is contained in:
M57 authored and GitHub committed 2026-07-23 13:04:10 +03:00
1 parent 992de56059
commit dcf26f1a16
3 files changed
+181 -4

No files matched your search

@@ -3,7 +3,7 @@ package com.m57.hermescontrol.data.config
import com.m57.hermescontrol.data.remote.CleartextPolicy
import com.m57.hermescontrol.data.remote.ServerEndpoint
fun ServerStoreState.addOrReplaceServer(profile: ConnectionProfile): ServerStoreState {
fun ServerStoreState.addOrUpdate(profile: ConnectionProfile): ServerStoreState {
val updated = connectionProfiles.filter { it.id != profile.id } + profile
return copy(connectionProfiles = updated)
}