mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
fix: The commit introduces imports from `src/channels/plugins/dm-acces
This commit is contained in:
committed by
Peter Steinberger
parent
5e384fed6d
commit
a512b5dde9
@@ -720,7 +720,7 @@ describe("whatsapp inbound dispatch", () => {
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
debug: vi.fn(),
|
||||
} as BufferedReplyParams["replyLogger"];
|
||||
} as unknown as BufferedReplyParams["replyLogger"];
|
||||
const error = new Error("send failed");
|
||||
|
||||
await dispatchBufferedReply({
|
||||
|
||||
@@ -14,10 +14,14 @@ import {
|
||||
createHybridChannelConfigBase,
|
||||
ensureOpenDmPolicyAllowFromWildcard,
|
||||
mapAllowFromEntries,
|
||||
normalizeChannelDmPolicy,
|
||||
normalizeLegacyDmAliases,
|
||||
resolveChannelDmAccess,
|
||||
resolveChannelDmAllowFrom,
|
||||
resolveChannelDmPolicy,
|
||||
resolveChannelConfigWrites,
|
||||
resolveOptionalConfigString,
|
||||
setCanonicalDmAllowFrom,
|
||||
} from "./channel-config-helpers.js";
|
||||
|
||||
const resolveDefaultAccountId = () => DEFAULT_ACCOUNT_ID;
|
||||
@@ -123,6 +127,38 @@ describe("resolveOptionalConfigString", () => {
|
||||
});
|
||||
|
||||
describe("channel DM access helpers", () => {
|
||||
it("re-exports centralized DM access helpers from the SDK entrypoint", () => {
|
||||
const entry = { dm: { policy: "allowlist", allowFrom: ["U1"] } };
|
||||
const changes: string[] = [];
|
||||
|
||||
expect(normalizeChannelDmPolicy("allowlist")).toBe("allowlist");
|
||||
expect(
|
||||
resolveChannelDmPolicy({
|
||||
account: entry,
|
||||
}),
|
||||
).toBe("allowlist");
|
||||
expect(
|
||||
resolveChannelDmAllowFrom({
|
||||
account: entry,
|
||||
}),
|
||||
).toEqual(["U1"]);
|
||||
|
||||
setCanonicalDmAllowFrom({
|
||||
entry,
|
||||
mode: "topOnly",
|
||||
allowFrom: ["U2"],
|
||||
pathPrefix: "channels.demo",
|
||||
changes,
|
||||
reason: "normalized by SDK helper",
|
||||
});
|
||||
|
||||
expect(entry).toEqual({ dm: { policy: "allowlist" }, allowFrom: ["U2"] });
|
||||
expect(changes).toEqual([
|
||||
"- channels.demo.dm.allowFrom: removed after moving allowlist to channels.demo.allowFrom",
|
||||
"- channels.demo.allowFrom: normalized by SDK helper",
|
||||
]);
|
||||
});
|
||||
|
||||
it("resolves account legacy allowFrom before inherited root allowFrom", () => {
|
||||
expect(
|
||||
resolveChannelDmAccess({
|
||||
|
||||
Reference in New Issue
Block a user