mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 07:38:30 +00:00
Automated rebrand of all openclaw references to hanzo bot: - Package: openclaw -> @hanzo/bot - Binary: openclaw -> hanzo-bot - Config: ~/.openclaw -> ~/.hanzo/bot - Docker: ghcr.io/hanzoai/bot - Env vars: OPENCLAW_* -> BOT_* - Bundle IDs: ai.hanzo.bot.* - Product name: Hanzo Bot
36 lines
1.3 KiB
Swift
36 lines
1.3 KiB
Swift
import Testing
|
|
@testable import Hanzo Bot
|
|
|
|
struct VoiceWakeHelpersTests {
|
|
@Test func `sanitize triggers trims and drops empty`() {
|
|
let cleaned = sanitizeVoiceWakeTriggers([" hi ", " ", "\n", "there"])
|
|
#expect(cleaned == ["hi", "there"])
|
|
}
|
|
|
|
@Test func `sanitize triggers falls back to defaults`() {
|
|
let cleaned = sanitizeVoiceWakeTriggers([" ", ""])
|
|
#expect(cleaned == defaultVoiceWakeTriggers)
|
|
}
|
|
|
|
@Test func `sanitize triggers limits word length`() {
|
|
let long = String(repeating: "x", count: voiceWakeMaxWordLength + 5)
|
|
let cleaned = sanitizeVoiceWakeTriggers(["ok", long])
|
|
#expect(cleaned[1].count == voiceWakeMaxWordLength)
|
|
}
|
|
|
|
@Test func `sanitize triggers limits word count`() {
|
|
let words = (1...voiceWakeMaxWords + 3).map { "w\($0)" }
|
|
let cleaned = sanitizeVoiceWakeTriggers(words)
|
|
#expect(cleaned.count == voiceWakeMaxWords)
|
|
}
|
|
|
|
@Test func `normalize locale strips collation`() {
|
|
#expect(normalizeLocaleIdentifier("en_US@collation=phonebook") == "en_US")
|
|
}
|
|
|
|
@Test func `normalize locale strips unicode extensions`() {
|
|
#expect(normalizeLocaleIdentifier("de-DE-u-co-phonebk") == "de-DE")
|
|
#expect(normalizeLocaleIdentifier("ja-JP-t-ja") == "ja-JP")
|
|
}
|
|
}
|