Files
bot/apps/macos/Tests/BotIPCTests/VoicePushToTalkHotkeyTests.swift
zeekay 08582cc303 Rebrand OpenClaw → Hanzo Bot across entire codebase
Complete rename of all OpenClaw/OPENCLAW/openclaw references to
Hanzo Bot/BOT/bot naming convention:

- Env vars: OPENCLAW_* → BOT_* (18 patterns)
- Config: ~/.openclaw/ → ~/.bot/, openclaw.json → bot.json
- Packages: @openclaw/* → @hanzo/bot-*
- Domains: openclaw.ai → hanzo.bot
- Mobile: OpenClawKit → BotKit, bundle IDs ai.openclaw → ai.hanzo.bot
- mDNS: _openclaw-gw._tcp → _bot-gw._tcp
- Docker: CMD hanzo-bot.mjs, BOT_PREFER_PNPM, BOT_DOCKER_APT_PACKAGES
- CI: docker-release.yml adds :latest tag on main branch
2026-02-11 11:13:08 -08:00

38 lines
1.2 KiB
Swift

import AppKit
import Testing
@testable import HanzoBot
@Suite(.serialized) struct VoicePushToTalkHotkeyTests {
actor Counter {
private(set) var began = 0
private(set) var ended = 0
func incBegin() { self.began += 1 }
func incEnd() { self.ended += 1 }
func snapshot() -> (began: Int, ended: Int) { (self.began, self.ended) }
}
@Test func beginEndFiresOncePerHold() async {
let counter = Counter()
let hotkey = VoicePushToTalkHotkey(
beginAction: { await counter.incBegin() },
endAction: { await counter.incEnd() })
await MainActor.run {
hotkey._testUpdateModifierState(keyCode: 61, modifierFlags: [.option])
hotkey._testUpdateModifierState(keyCode: 61, modifierFlags: [.option])
hotkey._testUpdateModifierState(keyCode: 61, modifierFlags: [])
}
for _ in 0..<50 {
let snap = await counter.snapshot()
if snap.began == 1, snap.ended == 1 { break }
try? await Task.sleep(nanoseconds: 10_000_000)
}
let snap = await counter.snapshot()
#expect(snap.began == 1)
#expect(snap.ended == 1)
}
}