2025-12-07 05:20:50 +01:00
|
|
|
import Testing
|
2026-01-04 14:32:47 +00:00
|
|
|
@testable import Clawdbot
|
|
|
|
|
@testable import ClawdbotIPC
|
2025-12-07 05:20:50 +01:00
|
|
|
|
2025-12-17 16:09:22 +01:00
|
|
|
@Suite(.serialized) struct GatewayConnectionControlTests {
|
2025-12-07 05:20:50 +01:00
|
|
|
@Test func statusFailsWhenProcessMissing() async {
|
2025-12-17 16:09:22 +01:00
|
|
|
let result = await GatewayConnection.shared.status()
|
2025-12-07 05:20:50 +01:00
|
|
|
// We don't assert ok because the worker may not be available in CI.
|
|
|
|
|
// Instead, ensure the call returns without throwing and provides a message.
|
|
|
|
|
#expect(result.ok == true || result.error != nil)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func rejectEmptyMessage() async {
|
2025-12-17 16:09:22 +01:00
|
|
|
let result = await GatewayConnection.shared.sendAgent(
|
|
|
|
|
message: "",
|
|
|
|
|
thinking: nil,
|
|
|
|
|
sessionKey: "main",
|
|
|
|
|
deliver: false,
|
|
|
|
|
to: nil)
|
2025-12-07 05:20:50 +01:00
|
|
|
#expect(result.ok == false)
|
|
|
|
|
}
|
|
|
|
|
}
|