2026-02-19 22:38:45 -08:00
|
|
|
import Testing
|
|
|
|
|
@testable import Sybil
|
|
|
|
|
|
2026-05-02 18:09:22 -07:00
|
|
|
@MainActor
|
|
|
|
|
@Test func normalizedAPIBaseURLPreservesExplicitAPIPath() async throws {
|
|
|
|
|
let defaults = UserDefaults(suiteName: #function)!
|
|
|
|
|
defaults.removePersistentDomain(forName: #function)
|
|
|
|
|
|
|
|
|
|
let settings = SybilSettingsStore(defaults: defaults)
|
|
|
|
|
settings.apiBaseURL = "https://sybil.bajor.cloud/api/"
|
|
|
|
|
|
|
|
|
|
#expect(settings.normalizedAPIBaseURL?.absoluteString == "https://sybil.bajor.cloud/api")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@MainActor
|
|
|
|
|
@Test func normalizedAPIBaseURLTrimsWhitespaceAndTrailingSlashes() async throws {
|
|
|
|
|
let defaults = UserDefaults(suiteName: #function)!
|
|
|
|
|
defaults.removePersistentDomain(forName: #function)
|
|
|
|
|
|
|
|
|
|
let settings = SybilSettingsStore(defaults: defaults)
|
|
|
|
|
settings.apiBaseURL = " http://127.0.0.1:8787/// "
|
|
|
|
|
|
|
|
|
|
#expect(settings.normalizedAPIBaseURL?.absoluteString == "http://127.0.0.1:8787")
|
2026-02-19 22:38:45 -08:00
|
|
|
}
|