mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 23:40:45 +00:00
32 lines
936 B
Swift
32 lines
936 B
Swift
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@MainActor
|
|
@Suite struct TalkModeConfigParsingTests {
|
|
@Test func prefersNormalizedTalkProviderPayload() {
|
|
let talk: [String: Any] = [
|
|
"provider": "elevenlabs",
|
|
"providers": [
|
|
"elevenlabs": [
|
|
"voiceId": "voice-normalized",
|
|
],
|
|
],
|
|
"voiceId": "voice-legacy",
|
|
]
|
|
|
|
let selection = TalkModeManager.selectTalkProviderConfig(talk)
|
|
#expect(selection?.provider == "elevenlabs")
|
|
#expect(selection?.config["voiceId"] as? String == "voice-normalized")
|
|
}
|
|
|
|
@Test func ignoresLegacyTalkFieldsWhenNormalizedPayloadMissing() {
|
|
let talk: [String: Any] = [
|
|
"voiceId": "voice-legacy",
|
|
"apiKey": "legacy-key",
|
|
]
|
|
|
|
let selection = TalkModeManager.selectTalkProviderConfig(talk)
|
|
#expect(selection == nil)
|
|
}
|
|
}
|