test: check scoped command secret targets

This commit is contained in:
Shakker
2026-05-12 05:25:02 +01:00
parent 4fe8f98faa
commit ef99cc670e

View File

@@ -103,10 +103,13 @@ describe("command secret target ids", () => {
channel: "discord",
});
expect(scoped.targetIds.size).toBeGreaterThan(0);
const targetIds = [...scoped.targetIds];
expect(targetIds.every((id) => id.startsWith("channels.discord."))).toBe(true);
expect(targetIds.some((id) => id.startsWith("channels.telegram."))).toBe(false);
expect(scoped.targetIds).toEqual(
new Set([
"channels.discord.accounts.chat.token",
"channels.discord.accounts.ops.token",
"channels.discord.token",
]),
);
});
it("does not coerce missing accountId to default when channel is scoped", () => {
@@ -127,8 +130,13 @@ describe("command secret target ids", () => {
});
expect(scoped.allowedPaths).toBeUndefined();
expect(scoped.targetIds.size).toBeGreaterThan(0);
expect([...scoped.targetIds].every((id) => id.startsWith("channels.discord."))).toBe(true);
expect(scoped.targetIds).toEqual(
new Set([
"channels.discord.accounts.chat.token",
"channels.discord.accounts.ops.token",
"channels.discord.token",
]),
);
});
it("scopes allowed paths to channel globals + selected account", () => {