mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-22 15:31:07 +00:00
* fix(secrets): scope message runtime resolution and harden doctor/status * docs: align message/doctor/status SecretRef behavior notes * test(cli): accept scoped targetIds wiring in secret-resolution coverage * fix(secrets): keep scoped allowedPaths isolation and tighten coverage gate * fix(secrets): avoid default-account coercion in scoped target selection * test(doctor): cover inactive telegram secretref inspect path * docs Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveMessageSecretScope } from "./message-secret-scope.js";
|
|
|
|
describe("resolveMessageSecretScope", () => {
|
|
it("prefers explicit channel/account inputs", () => {
|
|
expect(
|
|
resolveMessageSecretScope({
|
|
channel: "Discord",
|
|
accountId: "Ops",
|
|
}),
|
|
).toEqual({
|
|
channel: "discord",
|
|
accountId: "ops",
|
|
});
|
|
});
|
|
|
|
it("infers channel from a prefixed target", () => {
|
|
expect(
|
|
resolveMessageSecretScope({
|
|
target: "telegram:12345",
|
|
}),
|
|
).toEqual({
|
|
channel: "telegram",
|
|
});
|
|
});
|
|
|
|
it("infers a shared channel from target arrays", () => {
|
|
expect(
|
|
resolveMessageSecretScope({
|
|
targets: ["discord:one", "discord:two"],
|
|
}),
|
|
).toEqual({
|
|
channel: "discord",
|
|
});
|
|
});
|
|
|
|
it("does not infer a channel when target arrays mix channels", () => {
|
|
expect(
|
|
resolveMessageSecretScope({
|
|
targets: ["discord:one", "slack:two"],
|
|
}),
|
|
).toEqual({});
|
|
});
|
|
|
|
it("uses fallback channel/account when direct inputs are missing", () => {
|
|
expect(
|
|
resolveMessageSecretScope({
|
|
fallbackChannel: "Signal",
|
|
fallbackAccountId: "Chat",
|
|
}),
|
|
).toEqual({
|
|
channel: "signal",
|
|
accountId: "chat",
|
|
});
|
|
});
|
|
});
|