mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Comprehensive rename of all openclaw references to hanzo-bot equivalents: - Package: openclaw → @hanzo/bot - Binary: openclaw → hanzo-bot - Types: OpenClaw* → Bot* - Env vars: OPENCLAW_* → BOT_* - Android: ai.openclaw.android → ai.hanzo.bot.android - iOS/macOS: ai.openclaw.* → ai.hanzo.* - Swift modules: OpenClaw* → Bot* - Plugins: openclaw.plugin.json → bot.plugin.json - Paths: .openclaw/ → .hanzo/bot/ - URLs: github.com/openclaw → github.com/hanzoai
42 lines
1.7 KiB
Swift
42 lines
1.7 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import HanzoBot
|
|
|
|
@Suite struct GatewayLaunchAgentManagerTests {
|
|
@Test func launchAgentPlistSnapshotParsesArgsAndEnv() throws {
|
|
let url = FileManager().temporaryDirectory
|
|
.appendingPathComponent("hanzo-bot-launchd-\(UUID().uuidString).plist")
|
|
let plist: [String: Any] = [
|
|
"ProgramArguments": ["hanzo-bot", "gateway-daemon", "--port", "18789", "--bind", "loopback"],
|
|
"EnvironmentVariables": [
|
|
"BOT_GATEWAY_TOKEN": " secret ",
|
|
"BOT_GATEWAY_PASSWORD": "pw",
|
|
],
|
|
]
|
|
let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
|
|
try data.write(to: url, options: [.atomic])
|
|
defer { try? FileManager().removeItem(at: url) }
|
|
|
|
let snapshot = try #require(LaunchAgentPlist.snapshot(url: url))
|
|
#expect(snapshot.port == 18789)
|
|
#expect(snapshot.bind == "loopback")
|
|
#expect(snapshot.token == "secret")
|
|
#expect(snapshot.password == "pw")
|
|
}
|
|
|
|
@Test func launchAgentPlistSnapshotAllowsMissingBind() throws {
|
|
let url = FileManager().temporaryDirectory
|
|
.appendingPathComponent("hanzo-bot-launchd-\(UUID().uuidString).plist")
|
|
let plist: [String: Any] = [
|
|
"ProgramArguments": ["hanzo-bot", "gateway-daemon", "--port", "18789"],
|
|
]
|
|
let data = try PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0)
|
|
try data.write(to: url, options: [.atomic])
|
|
defer { try? FileManager().removeItem(at: url) }
|
|
|
|
let snapshot = try #require(LaunchAgentPlist.snapshot(url: url))
|
|
#expect(snapshot.port == 18789)
|
|
#expect(snapshot.bind == nil)
|
|
}
|
|
}
|