2025-12-20 14:46:53 +00:00
|
|
|
import Testing
|
2026-01-30 03:15:10 +01:00
|
|
|
@testable import OpenClaw
|
2025-12-20 14:46:53 +00:00
|
|
|
|
|
|
|
|
@Suite(.serialized)
|
|
|
|
|
struct GatewayAutostartPolicyTests {
|
|
|
|
|
@Test func startsGatewayOnlyWhenLocalAndNotPaused() {
|
|
|
|
|
#expect(GatewayAutostartPolicy.shouldStartGateway(mode: .local, paused: false))
|
|
|
|
|
#expect(!GatewayAutostartPolicy.shouldStartGateway(mode: .local, paused: true))
|
|
|
|
|
#expect(!GatewayAutostartPolicy.shouldStartGateway(mode: .remote, paused: false))
|
|
|
|
|
#expect(!GatewayAutostartPolicy.shouldStartGateway(mode: .unconfigured, paused: false))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test func ensuresLaunchAgentWhenLocalAndNotAttachOnly() {
|
|
|
|
|
#expect(GatewayAutostartPolicy.shouldEnsureLaunchAgent(
|
|
|
|
|
mode: .local,
|
2026-01-12 04:38:42 +00:00
|
|
|
paused: false))
|
2025-12-20 14:46:53 +00:00
|
|
|
#expect(!GatewayAutostartPolicy.shouldEnsureLaunchAgent(
|
|
|
|
|
mode: .local,
|
2026-01-12 04:38:42 +00:00
|
|
|
paused: true))
|
2025-12-20 14:46:53 +00:00
|
|
|
#expect(!GatewayAutostartPolicy.shouldEnsureLaunchAgent(
|
|
|
|
|
mode: .remote,
|
2026-01-12 04:38:42 +00:00
|
|
|
paused: false))
|
2025-12-20 14:46:53 +00:00
|
|
|
}
|
|
|
|
|
}
|