From d27b99c6af3fa642762ddfc2b04024f24912c2b9 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 27 Mar 2026 22:01:15 +0000 Subject: [PATCH] test: debrand helper fixture ids --- src/channels/plugins/helpers.test.ts | 40 +++++++++---------- .../plugins/threading-helpers.test.ts | 12 +++--- src/plugins/source-display.test.ts | 12 +++--- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/channels/plugins/helpers.test.ts b/src/channels/plugins/helpers.test.ts index 6b5f56c2ca3..4e62600e136 100644 --- a/src/channels/plugins/helpers.test.ts +++ b/src/channels/plugins/helpers.test.ts @@ -18,8 +18,8 @@ describe("buildAccountScopedDmSecurityPolicy", () => { it("builds top-level dm policy paths when no account config exists", () => { expect( buildAccountScopedDmSecurityPolicy({ - cfg: cfgWithChannel("telegram"), - channelKey: "telegram", + cfg: cfgWithChannel("demo-root"), + channelKey: "demo-root", fallbackAccountId: "default", policy: "pairing", allowFrom: ["123"], @@ -28,9 +28,9 @@ describe("buildAccountScopedDmSecurityPolicy", () => { ).toEqual({ policy: "pairing", allowFrom: ["123"], - policyPath: "channels.telegram.dmPolicy", - allowFromPath: "channels.telegram.", - approveHint: formatPairingApproveHint("telegram"), + policyPath: "channels.demo-root.dmPolicy", + allowFromPath: "channels.demo-root.", + approveHint: formatPairingApproveHint("demo-root"), normalizeEntry: undefined, }); }); @@ -38,8 +38,8 @@ describe("buildAccountScopedDmSecurityPolicy", () => { it("uses account-scoped paths when account config exists", () => { expect( buildAccountScopedDmSecurityPolicy({ - cfg: cfgWithChannel("signal", { work: {} }), - channelKey: "signal", + cfg: cfgWithChannel("demo-account", { work: {} }), + channelKey: "demo-account", accountId: "work", fallbackAccountId: "default", policy: "allowlist", @@ -49,9 +49,9 @@ describe("buildAccountScopedDmSecurityPolicy", () => { ).toEqual({ policy: "allowlist", allowFrom: ["+12125551212"], - policyPath: "channels.signal.accounts.work.dmPolicy", - allowFromPath: "channels.signal.accounts.work.", - approveHint: formatPairingApproveHint("signal"), + policyPath: "channels.demo-account.accounts.work.dmPolicy", + allowFromPath: "channels.demo-account.accounts.work.", + approveHint: formatPairingApproveHint("demo-account"), normalizeEntry: undefined, }); }); @@ -59,8 +59,8 @@ describe("buildAccountScopedDmSecurityPolicy", () => { it("supports nested dm paths without explicit policyPath", () => { expect( buildAccountScopedDmSecurityPolicy({ - cfg: cfgWithChannel("discord", { work: {} }), - channelKey: "discord", + cfg: cfgWithChannel("demo-nested", { work: {} }), + channelKey: "demo-nested", accountId: "work", policy: "pairing", allowFrom: [], @@ -70,8 +70,8 @@ describe("buildAccountScopedDmSecurityPolicy", () => { policy: "pairing", allowFrom: [], policyPath: undefined, - allowFromPath: "channels.discord.accounts.work.dm.", - approveHint: formatPairingApproveHint("discord"), + allowFromPath: "channels.demo-nested.accounts.work.dm.", + approveHint: formatPairingApproveHint("demo-nested"), normalizeEntry: undefined, }); }); @@ -79,20 +79,20 @@ describe("buildAccountScopedDmSecurityPolicy", () => { it("supports custom defaults and approve hints", () => { expect( buildAccountScopedDmSecurityPolicy({ - cfg: cfgWithChannel("synology-chat"), - channelKey: "synology-chat", + cfg: cfgWithChannel("demo-default"), + channelKey: "demo-default", fallbackAccountId: "default", allowFrom: ["user-1"], defaultPolicy: "allowlist", policyPathSuffix: "dmPolicy", - approveHint: "openclaw pairing approve synology-chat ", + approveHint: "openclaw pairing approve demo-default ", }), ).toEqual({ policy: "allowlist", allowFrom: ["user-1"], - policyPath: "channels.synology-chat.dmPolicy", - allowFromPath: "channels.synology-chat.", - approveHint: "openclaw pairing approve synology-chat ", + policyPath: "channels.demo-default.dmPolicy", + allowFromPath: "channels.demo-default.", + approveHint: "openclaw pairing approve demo-default ", normalizeEntry: undefined, }); }); diff --git a/src/channels/plugins/threading-helpers.test.ts b/src/channels/plugins/threading-helpers.test.ts index 48688d33ed0..4cc0c6c8cf3 100644 --- a/src/channels/plugins/threading-helpers.test.ts +++ b/src/channels/plugins/threading-helpers.test.ts @@ -15,16 +15,16 @@ describe("createStaticReplyToModeResolver", () => { describe("createTopLevelChannelReplyToModeResolver", () => { it("reads the top-level channel config", () => { - const resolver = createTopLevelChannelReplyToModeResolver("discord"); + const resolver = createTopLevelChannelReplyToModeResolver("demo-top-level"); expect( resolver({ - cfg: { channels: { discord: { replyToMode: "first" } } } as OpenClawConfig, + cfg: { channels: { "demo-top-level": { replyToMode: "first" } } } as OpenClawConfig, }), ).toBe("first"); }); it("falls back to off", () => { - const resolver = createTopLevelChannelReplyToModeResolver("discord"); + const resolver = createTopLevelChannelReplyToModeResolver("demo-top-level"); expect(resolver({ cfg: {} as OpenClawConfig })).toBe("off"); }); }); @@ -35,9 +35,9 @@ describe("createScopedAccountReplyToModeResolver", () => { resolveAccount: (cfg, accountId) => (( cfg.channels as { - matrix?: { accounts?: Record }; + demo?: { accounts?: Record }; } - ).matrix?.accounts?.[accountId?.toLowerCase() ?? "default"] ?? {}) as { + ).demo?.accounts?.[accountId?.toLowerCase() ?? "default"] ?? {}) as { replyToMode?: "off" | "first" | "all"; }, resolveReplyToMode: (account) => account.replyToMode, @@ -45,7 +45,7 @@ describe("createScopedAccountReplyToModeResolver", () => { const cfg = { channels: { - matrix: { + demo: { accounts: { assistant: { replyToMode: "all" }, }, diff --git a/src/plugins/source-display.test.ts b/src/plugins/source-display.test.ts index 1edd4abb2df..7fb1c023cb1 100644 --- a/src/plugins/source-display.test.ts +++ b/src/plugins/source-display.test.ts @@ -28,11 +28,11 @@ describe("formatPluginSourceForTable", () => { const out = formatPluginSourceForTable( { origin: "bundled", - source: path.join(roots.stock, "bluebubbles", "index.ts"), + source: path.join(roots.stock, "demo-stock", "index.ts"), }, roots, ); - expect(out.value).toBe("stock:bluebubbles/index.ts"); + expect(out.value).toBe("stock:demo-stock/index.ts"); expect(out.rootKey).toBe("stock"); }); @@ -41,11 +41,11 @@ describe("formatPluginSourceForTable", () => { const out = formatPluginSourceForTable( { origin: "workspace", - source: path.join(roots.workspace, "matrix", "index.ts"), + source: path.join(roots.workspace, "demo-workspace", "index.ts"), }, roots, ); - expect(out.value).toBe("workspace:matrix/index.ts"); + expect(out.value).toBe("workspace:demo-workspace/index.ts"); expect(out.rootKey).toBe("workspace"); }); @@ -54,11 +54,11 @@ describe("formatPluginSourceForTable", () => { const out = formatPluginSourceForTable( { origin: "global", - source: path.join(roots.global, "zalo", "index.js"), + source: path.join(roots.global, "demo-global", "index.js"), }, roots, ); - expect(out.value).toBe("global:zalo/index.js"); + expect(out.value).toBe("global:demo-global/index.js"); expect(out.rootKey).toBe("global"); });