mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 19:43:19 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
42 lines
1.3 KiB
Swift
42 lines
1.3 KiB
Swift
import OpenClawKit
|
|
import Testing
|
|
|
|
@Suite struct CanvasA2UITests {
|
|
@Test func commandStringsAreStable() {
|
|
#expect(OpenClawCanvasA2UICommand.push.rawValue == "canvas.a2ui.push")
|
|
#expect(OpenClawCanvasA2UICommand.pushJSONL.rawValue == "canvas.a2ui.pushJSONL")
|
|
#expect(OpenClawCanvasA2UICommand.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 OpenClawCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
|
|
#expect(messages.count == 4)
|
|
}
|
|
|
|
@Test func jsonlRejectsV0_9CreateSurface() {
|
|
let jsonl = """
|
|
{"createSurface":{"surfaceId":"main"}}
|
|
"""
|
|
|
|
#expect(throws: Error.self) {
|
|
_ = try OpenClawCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
|
|
}
|
|
}
|
|
|
|
@Test func jsonlRejectsUnknownShape() {
|
|
let jsonl = """
|
|
{"wat":{"nope":1}}
|
|
"""
|
|
|
|
#expect(throws: Error.self) {
|
|
_ = try OpenClawCanvasA2UIJSONL.decodeMessagesFromJSONL(jsonl)
|
|
}
|
|
}
|
|
}
|