mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:37:38 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -8,7 +8,7 @@ describe("noteMacLaunchctlGatewayEnvOverrides", () => {
|
||||
it("prints clear unsetenv instructions for token override", async () => {
|
||||
const noteFn = vi.fn();
|
||||
const getenv = vi.fn(async (name: string) =>
|
||||
name === "CLAWDBOT_GATEWAY_TOKEN" ? "launchctl-token" : undefined,
|
||||
name === "OPENCLAW_GATEWAY_TOKEN" ? "launchctl-token" : undefined,
|
||||
);
|
||||
const cfg = {
|
||||
gateway: {
|
||||
@@ -16,25 +16,25 @@ describe("noteMacLaunchctlGatewayEnvOverrides", () => {
|
||||
token: "config-token",
|
||||
},
|
||||
},
|
||||
} as MoltbotConfig;
|
||||
} as OpenClawConfig;
|
||||
|
||||
await noteMacLaunchctlGatewayEnvOverrides(cfg, { platform: "darwin", getenv, noteFn });
|
||||
|
||||
expect(noteFn).toHaveBeenCalledTimes(1);
|
||||
expect(getenv).toHaveBeenCalledTimes(2);
|
||||
expect(getenv).toHaveBeenCalledTimes(6);
|
||||
|
||||
const [message, title] = noteFn.mock.calls[0] ?? [];
|
||||
expect(title).toBe("Gateway (macOS)");
|
||||
expect(message).toContain("launchctl environment overrides detected");
|
||||
expect(message).toContain("CLAWDBOT_GATEWAY_TOKEN");
|
||||
expect(message).toContain("launchctl unsetenv CLAWDBOT_GATEWAY_TOKEN");
|
||||
expect(message).not.toContain("CLAWDBOT_GATEWAY_PASSWORD");
|
||||
expect(message).toContain("OPENCLAW_GATEWAY_TOKEN");
|
||||
expect(message).toContain("launchctl unsetenv OPENCLAW_GATEWAY_TOKEN");
|
||||
expect(message).not.toContain("OPENCLAW_GATEWAY_PASSWORD");
|
||||
});
|
||||
|
||||
it("does nothing when config has no gateway credentials", async () => {
|
||||
const noteFn = vi.fn();
|
||||
const getenv = vi.fn(async () => "launchctl-token");
|
||||
const cfg = {} as MoltbotConfig;
|
||||
const cfg = {} as OpenClawConfig;
|
||||
|
||||
await noteMacLaunchctlGatewayEnvOverrides(cfg, { platform: "darwin", getenv, noteFn });
|
||||
|
||||
@@ -51,7 +51,7 @@ describe("noteMacLaunchctlGatewayEnvOverrides", () => {
|
||||
token: "config-token",
|
||||
},
|
||||
},
|
||||
} as MoltbotConfig;
|
||||
} as OpenClawConfig;
|
||||
|
||||
await noteMacLaunchctlGatewayEnvOverrides(cfg, { platform: "linux", getenv, noteFn });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user