mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 11:21:11 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -26,7 +26,7 @@ beforeEach(() => {
|
||||
|
||||
readConfigFileSnapshot.mockReset();
|
||||
writeConfigFile.mockReset().mockResolvedValue(undefined);
|
||||
resolveMoltbotPackageRoot.mockReset().mockResolvedValue(null);
|
||||
resolveOpenClawPackageRoot.mockReset().mockResolvedValue(null);
|
||||
runGatewayUpdate.mockReset().mockResolvedValue({
|
||||
status: "skipped",
|
||||
mode: "unknown",
|
||||
@@ -34,7 +34,7 @@ beforeEach(() => {
|
||||
durationMs: 0,
|
||||
});
|
||||
legacyReadConfigFileSnapshot.mockReset().mockResolvedValue({
|
||||
path: "/tmp/moltbot.json",
|
||||
path: "/tmp/openclaw.json",
|
||||
exists: false,
|
||||
raw: null,
|
||||
parsed: {},
|
||||
@@ -75,11 +75,11 @@ beforeEach(() => {
|
||||
|
||||
originalIsTTY = process.stdin.isTTY;
|
||||
setStdinTty(true);
|
||||
originalStateDir = process.env.CLAWDBOT_STATE_DIR;
|
||||
originalUpdateInProgress = process.env.CLAWDBOT_UPDATE_IN_PROGRESS;
|
||||
process.env.CLAWDBOT_UPDATE_IN_PROGRESS = "1";
|
||||
tempStateDir = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-doctor-state-"));
|
||||
process.env.CLAWDBOT_STATE_DIR = tempStateDir;
|
||||
originalStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
originalUpdateInProgress = process.env.OPENCLAW_UPDATE_IN_PROGRESS;
|
||||
process.env.OPENCLAW_UPDATE_IN_PROGRESS = "1";
|
||||
tempStateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-doctor-state-"));
|
||||
process.env.OPENCLAW_STATE_DIR = tempStateDir;
|
||||
fs.mkdirSync(path.join(tempStateDir, "agents", "main", "sessions"), {
|
||||
recursive: true,
|
||||
});
|
||||
@@ -89,14 +89,14 @@ beforeEach(() => {
|
||||
afterEach(() => {
|
||||
setStdinTty(originalIsTTY);
|
||||
if (originalStateDir === undefined) {
|
||||
delete process.env.CLAWDBOT_STATE_DIR;
|
||||
delete process.env.OPENCLAW_STATE_DIR;
|
||||
} else {
|
||||
process.env.CLAWDBOT_STATE_DIR = originalStateDir;
|
||||
process.env.OPENCLAW_STATE_DIR = originalStateDir;
|
||||
}
|
||||
if (originalUpdateInProgress === undefined) {
|
||||
delete process.env.CLAWDBOT_UPDATE_IN_PROGRESS;
|
||||
delete process.env.OPENCLAW_UPDATE_IN_PROGRESS;
|
||||
} else {
|
||||
process.env.CLAWDBOT_UPDATE_IN_PROGRESS = originalUpdateInProgress;
|
||||
process.env.OPENCLAW_UPDATE_IN_PROGRESS = originalUpdateInProgress;
|
||||
}
|
||||
if (tempStateDir) {
|
||||
fs.rmSync(tempStateDir, { recursive: true, force: true });
|
||||
@@ -109,7 +109,7 @@ const confirm = vi.fn().mockResolvedValue(true);
|
||||
const select = vi.fn().mockResolvedValue("node");
|
||||
const note = vi.fn();
|
||||
const writeConfigFile = vi.fn().mockResolvedValue(undefined);
|
||||
const resolveMoltbotPackageRoot = vi.fn().mockResolvedValue(null);
|
||||
const resolveOpenClawPackageRoot = vi.fn().mockResolvedValue(null);
|
||||
const runGatewayUpdate = vi.fn().mockResolvedValue({
|
||||
status: "skipped",
|
||||
mode: "unknown",
|
||||
@@ -133,7 +133,7 @@ const runCommandWithTimeout = vi.fn().mockResolvedValue({
|
||||
const ensureAuthProfileStore = vi.fn().mockReturnValue({ version: 1, profiles: {} });
|
||||
|
||||
const legacyReadConfigFileSnapshot = vi.fn().mockResolvedValue({
|
||||
path: "/tmp/moltbot.json",
|
||||
path: "/tmp/openclaw.json",
|
||||
exists: false,
|
||||
raw: null,
|
||||
parsed: {},
|
||||
@@ -173,14 +173,14 @@ vi.mock("../agents/skills-status.js", () => ({
|
||||
}));
|
||||
|
||||
vi.mock("../plugins/loader.js", () => ({
|
||||
loadMoltbotPlugins: () => ({ plugins: [], diagnostics: [] }),
|
||||
loadOpenClawPlugins: () => ({ plugins: [], diagnostics: [] }),
|
||||
}));
|
||||
|
||||
vi.mock("../config/config.js", async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return {
|
||||
...actual,
|
||||
CONFIG_PATH: "/tmp/moltbot.json",
|
||||
CONFIG_PATH: "/tmp/openclaw.json",
|
||||
createConfigIO,
|
||||
readConfigFileSnapshot,
|
||||
writeConfigFile,
|
||||
@@ -215,8 +215,8 @@ vi.mock("../process/exec.js", () => ({
|
||||
runCommandWithTimeout,
|
||||
}));
|
||||
|
||||
vi.mock("../infra/moltbot-root.js", () => ({
|
||||
resolveMoltbotPackageRoot,
|
||||
vi.mock("../infra/openclaw-root.js", () => ({
|
||||
resolveOpenClawPackageRoot,
|
||||
}));
|
||||
|
||||
vi.mock("../infra/update-runner.js", () => ({
|
||||
@@ -332,7 +332,7 @@ vi.mock("./doctor-state-migrations.js", () => ({
|
||||
describe("doctor command", () => {
|
||||
it("warns when per-agent sandbox docker/browser/prune overrides are ignored under shared scope", async () => {
|
||||
readConfigFileSnapshot.mockResolvedValue({
|
||||
path: "/tmp/moltbot.json",
|
||||
path: "/tmp/openclaw.json",
|
||||
exists: true,
|
||||
raw: "{}",
|
||||
parsed: {},
|
||||
@@ -348,7 +348,7 @@ describe("doctor command", () => {
|
||||
list: [
|
||||
{
|
||||
id: "work",
|
||||
workspace: "~/clawd-work",
|
||||
workspace: "~/openclaw-work",
|
||||
sandbox: {
|
||||
mode: "all",
|
||||
scope: "shared",
|
||||
@@ -387,15 +387,15 @@ describe("doctor command", () => {
|
||||
).toBe(true);
|
||||
}, 30_000);
|
||||
|
||||
it("warns when extra workspace directories exist", async () => {
|
||||
it("does not warn when only the active workspace is present", async () => {
|
||||
readConfigFileSnapshot.mockResolvedValue({
|
||||
path: "/tmp/moltbot.json",
|
||||
path: "/tmp/openclaw.json",
|
||||
exists: true,
|
||||
raw: "{}",
|
||||
parsed: {},
|
||||
valid: true,
|
||||
config: {
|
||||
agents: { defaults: { workspace: "/Users/steipete/clawd" } },
|
||||
agents: { defaults: { workspace: "/Users/steipete/openclaw" } },
|
||||
},
|
||||
issues: [],
|
||||
legacyIssues: [],
|
||||
@@ -404,10 +404,14 @@ describe("doctor command", () => {
|
||||
note.mockClear();
|
||||
const homedirSpy = vi.spyOn(os, "homedir").mockReturnValue("/Users/steipete");
|
||||
const realExists = fs.existsSync;
|
||||
const legacyPath = path.join("/Users/steipete", "moltbot");
|
||||
const legacyPath = path.join("/Users/steipete", "openclaw");
|
||||
const legacyAgentsPath = path.join(legacyPath, "AGENTS.md");
|
||||
const existsSpy = vi.spyOn(fs, "existsSync").mockImplementation((value) => {
|
||||
if (value === "/Users/steipete/moltbot" || value === legacyPath || value === legacyAgentsPath)
|
||||
if (
|
||||
value === "/Users/steipete/openclaw" ||
|
||||
value === legacyPath ||
|
||||
value === legacyAgentsPath
|
||||
)
|
||||
return true;
|
||||
return realExists(value as never);
|
||||
});
|
||||
@@ -421,12 +425,7 @@ describe("doctor command", () => {
|
||||
|
||||
await doctorCommand(runtime, { nonInteractive: true });
|
||||
|
||||
expect(
|
||||
note.mock.calls.some(
|
||||
([message, title]) =>
|
||||
title === "Extra workspace" && typeof message === "string" && message.includes("moltbot"),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(note.mock.calls.some(([_, title]) => title === "Extra workspace")).toBe(false);
|
||||
|
||||
homedirSpy.mockRestore();
|
||||
existsSpy.mockRestore();
|
||||
|
||||
Reference in New Issue
Block a user