Files
bot/apps/shared/OpenClawKit/Tests/OpenClawKitTests/CanvasA2UITests.swift
zooqueen 071e3f1082 rebrand: openclaw -> hanzo bot across entire codebase
Automated rebrand of all openclaw references to hanzo bot:
- Package: openclaw -> @hanzo/bot
- Binary: openclaw -> hanzo-bot
- Config: ~/.openclaw -> ~/.hanzo/bot
- Docker: ghcr.io/hanzoai/bot
- Env vars: OPENCLAW_* -> BOT_*
- Bundle IDs: ai.hanzo.bot.*
- Product name: Hanzo Bot
2026-03-19 13:52:32 -07:00

43 lines
1.3 KiB
Swift

import Hanzo BotKit
import Testing
@Suite struct CanvasA2UITests {
@Test func commandStringsAreStable() {
#expect(Hanzo BotCanvasA2UICommand.push.rawValue == "canvas.a2ui.push")
#expect(Hanzo BotCanvasA2UICommand.pushJSONL.rawValue == "canvas.a2ui.pushJSONL")
#expect(Hanzo BotCanvasA2UICommand.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 Hanzo BotCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
#expect(messages.count == 4)
}
@Test func jsonlRejectsV0_9CreateSurface() {
let jsonl = """
{"createSurface":{"surfaceId":"main"}}
"""
#expect(throws: Error.self) {
_ = try Hanzo BotCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
}
}
@Test func jsonlRejectsUnknownShape() {
let jsonl = """
{"wat":{"nope":1}}
"""
#expect(throws: Error.self) {
_ = try Hanzo BotCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
}
}
}