mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
refactor: rename to openclaw
This commit is contained in:
@@ -6,16 +6,16 @@ describe("buildPairingReply", () => {
|
||||
let previousProfile: string | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
previousProfile = process.env.CLAWDBOT_PROFILE;
|
||||
process.env.CLAWDBOT_PROFILE = "isolated";
|
||||
previousProfile = process.env.OPENCLAW_PROFILE;
|
||||
process.env.OPENCLAW_PROFILE = "isolated";
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (previousProfile === undefined) {
|
||||
delete process.env.CLAWDBOT_PROFILE;
|
||||
delete process.env.OPENCLAW_PROFILE;
|
||||
return;
|
||||
}
|
||||
process.env.CLAWDBOT_PROFILE = previousProfile;
|
||||
process.env.OPENCLAW_PROFILE = previousProfile;
|
||||
});
|
||||
|
||||
const cases = [
|
||||
@@ -51,9 +51,9 @@ describe("buildPairingReply", () => {
|
||||
const text = buildPairingReply(testCase);
|
||||
expect(text).toContain(testCase.idLine);
|
||||
expect(text).toContain(`Pairing code: ${testCase.code}`);
|
||||
// CLI commands should respect CLAWDBOT_PROFILE when set (most tests run with isolated profile)
|
||||
// CLI commands should respect OPENCLAW_PROFILE when set (most tests run with isolated profile)
|
||||
const commandRe = new RegExp(
|
||||
`(?:moltbot|moltbot) --profile isolated pairing approve ${testCase.channel} <code>`,
|
||||
`(?:openclaw|openclaw) --profile isolated pairing approve ${testCase.channel} <code>`,
|
||||
);
|
||||
expect(text).toMatch(commandRe);
|
||||
});
|
||||
|
||||
@@ -8,13 +8,13 @@ export function buildPairingReply(params: {
|
||||
}): string {
|
||||
const { channel, idLine, code } = params;
|
||||
return [
|
||||
"Moltbot: access not configured.",
|
||||
"OpenClaw: access not configured.",
|
||||
"",
|
||||
idLine,
|
||||
"",
|
||||
`Pairing code: ${code}`,
|
||||
"",
|
||||
"Ask the bot owner to approve with:",
|
||||
formatCliCommand(`moltbot pairing approve ${channel} <code>`),
|
||||
formatCliCommand(`openclaw pairing approve ${channel} <code>`),
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ import { resolveOAuthDir } from "../config/paths.js";
|
||||
import { listChannelPairingRequests, upsertChannelPairingRequest } from "./pairing-store.js";
|
||||
|
||||
async function withTempStateDir<T>(fn: (stateDir: string) => Promise<T>) {
|
||||
const previous = process.env.CLAWDBOT_STATE_DIR;
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-pairing-"));
|
||||
process.env.CLAWDBOT_STATE_DIR = dir;
|
||||
const previous = process.env.OPENCLAW_STATE_DIR;
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-pairing-"));
|
||||
process.env.OPENCLAW_STATE_DIR = dir;
|
||||
try {
|
||||
return await fn(dir);
|
||||
} finally {
|
||||
if (previous === undefined) delete process.env.CLAWDBOT_STATE_DIR;
|
||||
else process.env.CLAWDBOT_STATE_DIR = previous;
|
||||
if (previous === undefined) delete process.env.OPENCLAW_STATE_DIR;
|
||||
else process.env.OPENCLAW_STATE_DIR = previous;
|
||||
await fs.rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user