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

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()
}
}