Files
openclaw-zero-token/daemon/runtime-hints.test.ts
sjhu 571e14a236 feat: upgrade to upstream v2026.3.28
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
2026-03-30 17:58:12 +08:00

72 lines
2.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { buildPlatformRuntimeLogHints, buildPlatformServiceStartHints } from "./runtime-hints.js";
describe("buildPlatformRuntimeLogHints", () => {
it("renders launchd log hints on darwin", () => {
expect(
buildPlatformRuntimeLogHints({
platform: "darwin",
env: {
OPENCLAW_STATE_DIR: "/tmp/openclaw-state",
OPENCLAW_LOG_PREFIX: "gateway",
},
systemdServiceName: "openclaw-gateway",
windowsTaskName: "OpenClaw Gateway",
}),
).toEqual([
"Launchd stdout (if installed): /tmp/openclaw-state/logs/gateway.log",
"Launchd stderr (if installed): /tmp/openclaw-state/logs/gateway.err.log",
]);
});
it("renders systemd and windows hints by platform", () => {
expect(
buildPlatformRuntimeLogHints({
platform: "linux",
systemdServiceName: "openclaw-gateway",
windowsTaskName: "OpenClaw Gateway",
}),
).toEqual(["Logs: journalctl --user -u openclaw-gateway.service -n 200 --no-pager"]);
expect(
buildPlatformRuntimeLogHints({
platform: "win32",
systemdServiceName: "openclaw-gateway",
windowsTaskName: "OpenClaw Gateway",
}),
).toEqual(['Logs: schtasks /Query /TN "OpenClaw Gateway" /V /FO LIST']);
});
});
describe("buildPlatformServiceStartHints", () => {
it("builds platform-specific service start hints", () => {
expect(
buildPlatformServiceStartHints({
platform: "darwin",
installCommand: "openclaw gateway install",
startCommand: "openclaw gateway",
launchAgentPlistPath: "~/Library/LaunchAgents/com.openclaw.gateway.plist",
systemdServiceName: "openclaw-gateway",
windowsTaskName: "OpenClaw Gateway",
}),
).toEqual([
"openclaw gateway install",
"openclaw gateway",
"launchctl bootstrap gui/$UID ~/Library/LaunchAgents/com.openclaw.gateway.plist",
]);
expect(
buildPlatformServiceStartHints({
platform: "linux",
installCommand: "openclaw gateway install",
startCommand: "openclaw gateway",
launchAgentPlistPath: "~/Library/LaunchAgents/com.openclaw.gateway.plist",
systemdServiceName: "openclaw-gateway",
windowsTaskName: "OpenClaw Gateway",
}),
).toEqual([
"openclaw gateway install",
"openclaw gateway",
"systemctl --user start openclaw-gateway.service",
]);
});
});