mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
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
43 lines
1.3 KiB
Swift
43 lines
1.3 KiB
Swift
import BotKit
|
|
import Testing
|
|
|
|
@Suite struct CanvasA2UITests {
|
|
@Test func commandStringsAreStable() {
|
|
#expect(HanzoBotCanvasA2UICommand.push.rawValue == "canvas.a2ui.push")
|
|
#expect(HanzoBotCanvasA2UICommand.pushJSONL.rawValue == "canvas.a2ui.pushJSONL")
|
|
#expect(HanzoBotCanvasA2UICommand.reset.rawValue == "canvas.a2ui.reset")
|
|
}
|
|
|
|
@Test func jsonlDecodesAndValidatesV0_8() throws {
|
|
let jsonl = """
|
|
{"beginRendering":{"surfaceId":"main","timestamp":1}}
|
|
{"surfaceUpdate":{"surfaceId":"main","ops":[]}}
|
|
{"dataModelUpdate":{"dataModel":{"title":"Hello"}}}
|
|
{"deleteSurface":{"surfaceId":"main"}}
|
|
"""
|
|
|
|
let messages = try HanzoBotCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
|
|
#expect(messages.count == 4)
|
|
}
|
|
|
|
@Test func jsonlRejectsV0_9CreateSurface() {
|
|
let jsonl = """
|
|
{"createSurface":{"surfaceId":"main"}}
|
|
"""
|
|
|
|
#expect(throws: Error.self) {
|
|
_ = try HanzoBotCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
|
|
}
|
|
}
|
|
|
|
@Test func jsonlRejectsUnknownShape() {
|
|
let jsonl = """
|
|
{"wat":{"nope":1}}
|
|
"""
|
|
|
|
#expect(throws: Error.self) {
|
|
_ = try HanzoBotCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
|
|
}
|
|
}
|
|
}
|