mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:41:22 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -4,7 +4,7 @@ import type { MockBaileysSocket } from "../../test/mocks/baileys.js";
|
||||
import { createMockBaileys } from "../../test/mocks/baileys.js";
|
||||
|
||||
// Use globalThis to store the mock config so it survives vi.mock hoisting
|
||||
const CONFIG_KEY = Symbol.for("moltbot:testConfigMock");
|
||||
const CONFIG_KEY = Symbol.for("openclaw:testConfigMock");
|
||||
const DEFAULT_CONFIG = {
|
||||
channels: {
|
||||
whatsapp: {
|
||||
@@ -54,7 +54,7 @@ vi.mock("../media/store.js", () => ({
|
||||
|
||||
vi.mock("@whiskeysockets/baileys", () => {
|
||||
const created = createMockBaileys();
|
||||
(globalThis as Record<PropertyKey, unknown>)[Symbol.for("moltbot:lastSocket")] =
|
||||
(globalThis as Record<PropertyKey, unknown>)[Symbol.for("openclaw:lastSocket")] =
|
||||
created.lastSocket;
|
||||
return created.mod;
|
||||
});
|
||||
@@ -74,7 +74,7 @@ export const baileys =
|
||||
|
||||
export function resetBaileysMocks() {
|
||||
const recreated = createMockBaileys();
|
||||
(globalThis as Record<PropertyKey, unknown>)[Symbol.for("moltbot:lastSocket")] =
|
||||
(globalThis as Record<PropertyKey, unknown>)[Symbol.for("openclaw:lastSocket")] =
|
||||
recreated.lastSocket;
|
||||
baileys.makeWASocket.mockImplementation(recreated.mod.makeWASocket);
|
||||
baileys.useMultiFileAuthState.mockImplementation(recreated.mod.useMultiFileAuthState);
|
||||
@@ -83,7 +83,7 @@ export function resetBaileysMocks() {
|
||||
}
|
||||
|
||||
export function getLastSocket(): MockBaileysSocket {
|
||||
const getter = (globalThis as Record<PropertyKey, unknown>)[Symbol.for("moltbot:lastSocket")];
|
||||
const getter = (globalThis as Record<PropertyKey, unknown>)[Symbol.for("openclaw:lastSocket")];
|
||||
if (typeof getter === "function") return (getter as () => MockBaileysSocket)();
|
||||
if (!getter) throw new Error("Baileys mock not initialized");
|
||||
throw new Error("Invalid Baileys socket getter");
|
||||
|
||||
Reference in New Issue
Block a user