mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
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
44 lines
1.1 KiB
Swift
44 lines
1.1 KiB
Swift
import Foundation
|
|
import Hanzo BotProtocol
|
|
import Testing
|
|
@testable import Hanzo Bot
|
|
|
|
@MainActor
|
|
struct AgentEventStoreTests {
|
|
@Test
|
|
func `append and clear`() {
|
|
let store = AgentEventStore()
|
|
#expect(store.events.isEmpty)
|
|
|
|
store.append(ControlAgentEvent(
|
|
runId: "run",
|
|
seq: 1,
|
|
stream: "test",
|
|
ts: 0,
|
|
data: [:] as [String: Hanzo BotProtocol.AnyCodable],
|
|
summary: nil))
|
|
#expect(store.events.count == 1)
|
|
|
|
store.clear()
|
|
#expect(store.events.isEmpty)
|
|
}
|
|
|
|
@Test
|
|
func `trims to max events`() {
|
|
let store = AgentEventStore()
|
|
for i in 1...401 {
|
|
store.append(ControlAgentEvent(
|
|
runId: "run",
|
|
seq: i,
|
|
stream: "test",
|
|
ts: Double(i),
|
|
data: [:] as [String: Hanzo BotProtocol.AnyCodable],
|
|
summary: nil))
|
|
}
|
|
|
|
#expect(store.events.count == 400)
|
|
#expect(store.events.first?.seq == 2)
|
|
#expect(store.events.last?.seq == 401)
|
|
}
|
|
}
|