2025-12-17 23:05:28 +01:00
|
|
|
import Testing
|
2026-01-30 03:15:10 +01:00
|
|
|
@testable import OpenClaw
|
2025-12-17 23:05:28 +01:00
|
|
|
|
|
|
|
|
@Suite struct GatewayAgentChannelTests {
|
|
|
|
|
@Test func shouldDeliverBlocksWebChat() {
|
|
|
|
|
#expect(GatewayAgentChannel.webchat.shouldDeliver(true) == false)
|
|
|
|
|
#expect(GatewayAgentChannel.webchat.shouldDeliver(false) == false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func shouldDeliverAllowsLastAndProviderChannels() {
|
|
|
|
|
#expect(GatewayAgentChannel.last.shouldDeliver(true) == true)
|
|
|
|
|
#expect(GatewayAgentChannel.whatsapp.shouldDeliver(true) == true)
|
|
|
|
|
#expect(GatewayAgentChannel.telegram.shouldDeliver(true) == true)
|
2026-01-23 16:45:37 -06:00
|
|
|
#expect(GatewayAgentChannel.googlechat.shouldDeliver(true) == true)
|
2026-01-19 18:39:56 -08:00
|
|
|
#expect(GatewayAgentChannel.bluebubbles.shouldDeliver(true) == true)
|
2025-12-17 23:05:28 +01:00
|
|
|
#expect(GatewayAgentChannel.last.shouldDeliver(false) == false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func initRawNormalizesAndFallsBackToLast() {
|
|
|
|
|
#expect(GatewayAgentChannel(raw: nil) == .last)
|
|
|
|
|
#expect(GatewayAgentChannel(raw: " ") == .last)
|
|
|
|
|
#expect(GatewayAgentChannel(raw: "WEBCHAT") == .webchat)
|
2026-01-23 16:45:37 -06:00
|
|
|
#expect(GatewayAgentChannel(raw: "googlechat") == .googlechat)
|
2026-01-19 18:39:56 -08:00
|
|
|
#expect(GatewayAgentChannel(raw: "BLUEBUBBLES") == .bluebubbles)
|
2025-12-17 23:05:28 +01:00
|
|
|
#expect(GatewayAgentChannel(raw: "unknown") == .last)
|
|
|
|
|
}
|
|
|
|
|
}
|