Files
bot/apps/macos/Tests/BotIPCTests/WebChatSwiftUISmokeTests.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

61 lines
2.0 KiB
Swift

import AppKit
import BotChatUI
import Foundation
import Testing
@testable import HanzoBot
@Suite(.serialized)
@MainActor
struct WebChatSwiftUISmokeTests {
private struct TestTransport: HanzoBotChatTransport, Sendable {
func requestHistory(sessionKey: String) async throws -> HanzoBotChatHistoryPayload {
let json = """
{"sessionKey":"\(sessionKey)","sessionId":null,"messages":[],"thinkingLevel":"off"}
"""
return try JSONDecoder().decode(HanzoBotChatHistoryPayload.self, from: Data(json.utf8))
}
func sendMessage(
sessionKey _: String,
message _: String,
thinking _: String,
idempotencyKey _: String,
attachments _: [HanzoBotChatAttachmentPayload]) async throws -> HanzoBotChatSendResponse
{
let json = """
{"runId":"\(UUID().uuidString)","status":"ok"}
"""
return try JSONDecoder().decode(HanzoBotChatSendResponse.self, from: Data(json.utf8))
}
func requestHealth(timeoutMs _: Int) async throws -> Bool { true }
func events() -> AsyncStream<HanzoBotChatTransportEvent> {
AsyncStream { continuation in
continuation.finish()
}
}
func setActiveSessionKey(_: String) async throws {}
}
@Test func windowControllerShowAndClose() {
let controller = WebChatSwiftUIWindowController(
sessionKey: "main",
presentation: .window,
transport: TestTransport())
controller.show()
controller.close()
}
@Test func panelControllerPresentAndClose() {
let anchor = { NSRect(x: 200, y: 400, width: 40, height: 40) }
let controller = WebChatSwiftUIWindowController(
sessionKey: "main",
presentation: .panel(anchorProvider: anchor),
transport: TestTransport())
controller.presentAnchored(anchorProvider: anchor)
controller.close()
}
}