mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 23:40:45 +00:00
* Secrets: add inline allowlist review set * Secrets: narrow detect-secrets file exclusions * Secrets: exclude Docker fingerprint false positive * Secrets: allowlist test and docs false positives * Secrets: refresh baseline after allowlist updates * Secrets: fix gateway chat fixture pragma * Secrets: format pre-commit config * Android: keep talk mode fixture JSON valid * Feishu: rely on client timeout injection * Secrets: allowlist provider auth test fixtures * Secrets: allowlist onboard search fixtures * Secrets: allowlist onboard mode fixture * Secrets: allowlist gateway auth mode fixture * Secrets: allowlist APNS wake test key * Secrets: allowlist gateway reload fixtures * Secrets: allowlist moonshot video fixture * Secrets: allowlist auto audio fixture * Secrets: allowlist tiny audio fixture * Secrets: allowlist embeddings fixtures * Secrets: allowlist resolve fixtures * Secrets: allowlist target registry pattern fixtures * Secrets: allowlist gateway chat env fixture * Secrets: refresh baseline after fixture allowlists * Secrets: reapply gateway chat env allowlist * Secrets: reapply gateway chat env allowlist * Secrets: stabilize gateway chat env allowlist * Secrets: allowlist runtime snapshot save fixture * Secrets: allowlist oauth profile fixtures * Secrets: allowlist compaction identifier fixture * Secrets: allowlist model auth fixture * Secrets: allowlist model status fixtures * Secrets: allowlist custom onboarding fixture * Secrets: allowlist mattermost token summary fixtures * Secrets: allowlist gateway auth suite fixtures * Secrets: allowlist channel summary fixture * Secrets: allowlist provider usage auth fixtures * Secrets: allowlist media proxy fixture * Secrets: allowlist secrets audit fixtures * Secrets: refresh baseline after final fixture allowlists * Feishu: prefer explicit client timeout * Feishu: test direct timeout precedence
51 lines
1.6 KiB
Swift
51 lines
1.6 KiB
Swift
import Foundation
|
|
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", // pragma: allowlist secret
|
|
]
|
|
|
|
let selection = TalkModeManager.selectTalkProviderConfig(talk)
|
|
#expect(selection == nil)
|
|
}
|
|
|
|
@Test func detectsPCMFormatRejectionFromElevenLabsError() {
|
|
let error = NSError(
|
|
domain: "ElevenLabsTTS",
|
|
code: 403,
|
|
userInfo: [
|
|
NSLocalizedDescriptionKey: "ElevenLabs failed: 403 subscription_required output_format=pcm_44100",
|
|
])
|
|
#expect(TalkModeManager._test_isPCMFormatRejectedByAPI(error))
|
|
}
|
|
|
|
@Test func ignoresGenericPlaybackFailuresForPCMFormatRejection() {
|
|
let error = NSError(
|
|
domain: "StreamingAudio",
|
|
code: -1,
|
|
userInfo: [NSLocalizedDescriptionKey: "queue enqueue failed"])
|
|
#expect(TalkModeManager._test_isPCMFormatRejectedByAPI(error) == false)
|
|
}
|
|
}
|