mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Squash merge of 1,462 upstream commits with openclaw→hanzo-bot naming transforms applied. Conflicts resolved favoring our main branch to preserve existing customizations. Key upstream additions: - iOS Security Stack (concurrency locks, runtime guards, TTS fallback) - Discord CDN hostname allowlisting for SSRF protection - Discord mention handling improvements - Various bug fixes and stability improvements
46 lines
1.1 KiB
Swift
46 lines
1.1 KiB
Swift
import HanzoBotProtocol
|
|
import Foundation
|
|
import BotProtocol
|
|
import Testing
|
|
@testable import HanzoBot
|
|
|
|
@Suite
|
|
@MainActor
|
|
struct AgentEventStoreTests {
|
|
@Test
|
|
func appendAndClear() {
|
|
let store = AgentEventStore()
|
|
#expect(store.events.isEmpty)
|
|
|
|
store.append(ControlAgentEvent(
|
|
runId: "run",
|
|
seq: 1,
|
|
stream: "test",
|
|
ts: 0,
|
|
data: [:] as [String: HanzoBotProtocol.AnyCodable],
|
|
summary: nil))
|
|
#expect(store.events.count == 1)
|
|
|
|
store.clear()
|
|
#expect(store.events.isEmpty)
|
|
}
|
|
|
|
@Test
|
|
func trimsToMaxEvents() {
|
|
let store = AgentEventStore()
|
|
for i in 1...401 {
|
|
store.append(ControlAgentEvent(
|
|
runId: "run",
|
|
seq: i,
|
|
stream: "test",
|
|
ts: Double(i),
|
|
data: [:] as [String: HanzoBotProtocol.AnyCodable],
|
|
summary: nil))
|
|
}
|
|
|
|
#expect(store.events.count == 400)
|
|
#expect(store.events.first?.seq == 2)
|
|
#expect(store.events.last?.seq == 401)
|
|
}
|
|
}
|