Add shared native chat handling for /new, /reset, and /clear. This also aligns main session key handling in the shared chat UI and includes follow-up test and CI fixes needed to keep the branch mergeable. Co-authored-by: Nachx639 <71144023+Nachx639@users.noreply.github.com> Co-authored-by: Luke <92253590+ImLukeF@users.noreply.github.com>
36 lines
1.2 KiB
Swift
36 lines
1.2 KiB
Swift
import OpenClawKit
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
@Suite struct IOSGatewayChatTransportTests {
|
|
@Test func requestsFailFastWhenGatewayNotConnected() async {
|
|
let gateway = GatewayNodeSession()
|
|
let transport = IOSGatewayChatTransport(gateway: gateway)
|
|
|
|
do {
|
|
_ = try await transport.requestHistory(sessionKey: "node-test")
|
|
Issue.record("Expected requestHistory to throw when gateway not connected")
|
|
} catch {}
|
|
|
|
do {
|
|
_ = try await transport.sendMessage(
|
|
sessionKey: "node-test",
|
|
message: "hello",
|
|
thinking: "low",
|
|
idempotencyKey: "idempotency",
|
|
attachments: [])
|
|
Issue.record("Expected sendMessage to throw when gateway not connected")
|
|
} catch {}
|
|
|
|
do {
|
|
_ = try await transport.requestHealth(timeoutMs: 250)
|
|
Issue.record("Expected requestHealth to throw when gateway not connected")
|
|
} catch {}
|
|
|
|
do {
|
|
try await transport.resetSession(sessionKey: "node-test")
|
|
Issue.record("Expected resetSession to throw when gateway not connected")
|
|
} catch {}
|
|
}
|
|
}
|