Files
bot/apps/macos/Tests/BotIPCTests/VoiceWakeGlobalSettingsSyncTests.swift
zeekay 4bdc9ee3e4 chore: rebrand openclaw → hanzo-bot for bridge merge
Comprehensive rename of all openclaw references to hanzo-bot equivalents:
- Package: openclaw → @hanzo/bot
- Binary: openclaw → hanzo-bot
- Types: OpenClaw* → Bot*
- Env vars: OPENCLAW_* → BOT_*
- Android: ai.openclaw.android → ai.hanzo.bot.android
- iOS/macOS: ai.openclaw.* → ai.hanzo.*
- Swift modules: OpenClaw* → Bot*
- Plugins: openclaw.plugin.json → bot.plugin.json
- Paths: .openclaw/ → .hanzo/bot/
- URLs: github.com/openclaw → github.com/hanzoai
2026-02-26 22:36:01 -08:00

57 lines
1.8 KiB
Swift

import HanzoBotProtocol
import Foundation
import Testing
@testable import HanzoBot
@Suite(.serialized) struct VoiceWakeGlobalSettingsSyncTests {
@Test func appliesVoiceWakeChangedEventToAppState() async {
let previous = await MainActor.run { AppStateStore.shared.swabbleTriggerWords }
await MainActor.run {
AppStateStore.shared.applyGlobalVoiceWakeTriggers(["before"])
}
let payload = HanzoBotProtocol.AnyCodable(["triggers": ["hanzo-bot", "computer"]])
let evt = EventFrame(
type: "event",
event: "voicewake.changed",
payload: payload,
seq: nil,
stateversion: nil)
await VoiceWakeGlobalSettingsSync.shared.handle(push: .event(evt))
let updated = await MainActor.run { AppStateStore.shared.swabbleTriggerWords }
#expect(updated == ["hanzo-bot", "computer"])
await MainActor.run {
AppStateStore.shared.applyGlobalVoiceWakeTriggers(previous)
}
}
@Test func ignoresVoiceWakeChangedEventWithInvalidPayload() async {
let previous = await MainActor.run { AppStateStore.shared.swabbleTriggerWords }
await MainActor.run {
AppStateStore.shared.applyGlobalVoiceWakeTriggers(["before"])
}
let payload = HanzoBotProtocol.AnyCodable(["unexpected": 123])
let evt = EventFrame(
type: "event",
event: "voicewake.changed",
payload: payload,
seq: nil,
stateversion: nil)
await VoiceWakeGlobalSettingsSync.shared.handle(push: .event(evt))
let updated = await MainActor.run { AppStateStore.shared.swabbleTriggerWords }
#expect(updated == ["before"])
await MainActor.run {
AppStateStore.shared.applyGlobalVoiceWakeTriggers(previous)
}
}
}