mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03:00
refactor: rename to openclaw
This commit is contained in:
+9
-9
@@ -39,7 +39,7 @@ describe("withWhatsAppPrefix", () => {
|
||||
|
||||
describe("ensureDir", () => {
|
||||
it("creates nested directory", async () => {
|
||||
const tmp = await fs.promises.mkdtemp(path.join(os.tmpdir(), "moltbot-test-"));
|
||||
const tmp = await fs.promises.mkdtemp(path.join(os.tmpdir(), "openclaw-test-"));
|
||||
const target = path.join(tmp, "nested", "dir");
|
||||
await ensureDir(target);
|
||||
expect(fs.existsSync(target)).toBe(true);
|
||||
@@ -91,7 +91,7 @@ describe("jidToE164", () => {
|
||||
});
|
||||
|
||||
it("maps @lid from authDir mapping files", () => {
|
||||
const authDir = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-auth-"));
|
||||
const authDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-auth-"));
|
||||
const mappingPath = path.join(authDir, "lid-mapping-456_reverse.json");
|
||||
fs.writeFileSync(mappingPath, JSON.stringify("5559876"));
|
||||
expect(jidToE164("456@lid", { authDir })).toBe("+5559876");
|
||||
@@ -99,7 +99,7 @@ describe("jidToE164", () => {
|
||||
});
|
||||
|
||||
it("maps @hosted.lid from authDir mapping files", () => {
|
||||
const authDir = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-auth-"));
|
||||
const authDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-auth-"));
|
||||
const mappingPath = path.join(authDir, "lid-mapping-789_reverse.json");
|
||||
fs.writeFileSync(mappingPath, JSON.stringify(4440001));
|
||||
expect(jidToE164("789@hosted.lid", { authDir })).toBe("+4440001");
|
||||
@@ -111,8 +111,8 @@ describe("jidToE164", () => {
|
||||
});
|
||||
|
||||
it("falls back through lidMappingDirs in order", () => {
|
||||
const first = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-lid-a-"));
|
||||
const second = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-lid-b-"));
|
||||
const first = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-lid-a-"));
|
||||
const second = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-lid-b-"));
|
||||
const mappingPath = path.join(second, "lid-mapping-321_reverse.json");
|
||||
fs.writeFileSync(mappingPath, JSON.stringify("123321"));
|
||||
expect(jidToE164("321@lid", { lidMappingDirs: [first, second] })).toBe("+123321");
|
||||
@@ -122,10 +122,10 @@ describe("jidToE164", () => {
|
||||
});
|
||||
|
||||
describe("resolveConfigDir", () => {
|
||||
it("prefers ~/.moltbot when legacy dir is missing", async () => {
|
||||
const root = await fs.promises.mkdtemp(path.join(os.tmpdir(), "moltbot-config-dir-"));
|
||||
it("prefers ~/.openclaw when legacy dir is missing", async () => {
|
||||
const root = await fs.promises.mkdtemp(path.join(os.tmpdir(), "openclaw-config-dir-"));
|
||||
try {
|
||||
const newDir = path.join(root, ".moltbot");
|
||||
const newDir = path.join(root, ".openclaw");
|
||||
await fs.promises.mkdir(newDir, { recursive: true });
|
||||
const resolved = resolveConfigDir({} as NodeJS.ProcessEnv, () => root);
|
||||
expect(resolved).toBe(newDir);
|
||||
@@ -159,7 +159,7 @@ describe("resolveUserPath", () => {
|
||||
});
|
||||
|
||||
it("expands ~/ to home dir", () => {
|
||||
expect(resolveUserPath("~/clawd")).toBe(path.resolve(os.homedir(), "clawd"));
|
||||
expect(resolveUserPath("~/openclaw")).toBe(path.resolve(os.homedir(), "openclaw"));
|
||||
});
|
||||
|
||||
it("resolves relative paths", () => {
|
||||
|
||||
Reference in New Issue
Block a user