Files
bot/apps/macos/Tests/BotIPCTests/LowCoverageViewSmokeTests.swift
zeekay bb5ae75492 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

100 lines
3.6 KiB
Swift

import AppKit
import HanzoBotProtocol
import SwiftUI
import Testing
@testable import HanzoBot
@Suite(.serialized)
@MainActor
struct LowCoverageViewSmokeTests {
@Test func contextMenuCardBuildsBody() {
let loading = ContextMenuCardView(rows: [], statusText: "Loading…", isLoading: true)
_ = loading.body
let empty = ContextMenuCardView(rows: [], statusText: nil, isLoading: false)
_ = empty.body
let withRows = ContextMenuCardView(rows: SessionRow.previewRows, statusText: nil, isLoading: false)
_ = withRows.body
}
@Test func settingsToggleRowBuildsBody() {
var flag = false
let binding = Binding(get: { flag }, set: { flag = $0 })
let view = SettingsToggleRow(title: "Enable", subtitle: "Detail", binding: binding)
_ = view.body
}
@Test func voiceWakeTestCardBuildsBodyAcrossStates() {
var state = VoiceWakeTestState.idle
var isTesting = false
let stateBinding = Binding(get: { state }, set: { state = $0 })
let testingBinding = Binding(get: { isTesting }, set: { isTesting = $0 })
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
state = .hearing("hello")
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
state = .detected("command")
isTesting = true
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
state = .failed("No mic")
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
}
@Test func agentEventsWindowBuildsBodyWithEvent() {
AgentEventStore.shared.clear()
let sample = ControlAgentEvent(
runId: "run-1",
seq: 1,
stream: "tool",
ts: Date().timeIntervalSince1970 * 1000,
data: ["phase": AnyCodable("start"), "name": AnyCodable("test")],
summary: nil)
AgentEventStore.shared.append(sample)
_ = AgentEventsWindow().body
AgentEventStore.shared.clear()
}
@Test func notifyOverlayPresentsAndDismisses() async {
let controller = NotifyOverlayController()
controller.present(title: "Hello", body: "World", autoDismissAfter: 0)
controller.present(title: "Updated", body: "Again", autoDismissAfter: 0)
controller.dismiss()
try? await Task.sleep(nanoseconds: 250_000_000)
}
@Test func visualEffectViewHostsInNSHostingView() {
let hosting = NSHostingView(rootView: VisualEffectView(material: .sidebar))
_ = hosting.fittingSize
hosting.rootView = VisualEffectView(material: .popover, emphasized: true)
_ = hosting.fittingSize
}
@Test func menuHostedItemHostsContent() {
let view = MenuHostedItem(width: 240, rootView: AnyView(Text("Menu")))
let hosting = NSHostingView(rootView: view)
_ = hosting.fittingSize
hosting.rootView = MenuHostedItem(width: 320, rootView: AnyView(Text("Updated")))
_ = hosting.fittingSize
}
@Test func dockIconManagerUpdatesVisibility() {
_ = NSApplication.shared
UserDefaults.standard.set(false, forKey: showDockIconKey)
DockIconManager.shared.updateDockVisibility()
DockIconManager.shared.temporarilyShowDock()
}
@Test func voiceWakeSettingsExercisesHelpers() {
VoiceWakeSettings.exerciseForTesting()
}
@Test func debugSettingsExercisesHelpers() async {
await DebugSettings.exerciseForTesting()
}
}