From 3fe229182ffe14bec30bb0f5927e6a3f00d4e62d Mon Sep 17 00:00:00 2001 From: Shakker Date: Mon, 11 May 2026 08:38:41 +0100 Subject: [PATCH] test: tighten discord voice access assertions --- extensions/discord/src/voice/access.test.ts | 81 +++++++++++++++++++-- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/extensions/discord/src/voice/access.test.ts b/extensions/discord/src/voice/access.test.ts index 92d02634604..de9575f4611 100644 --- a/extensions/discord/src/voice/access.test.ts +++ b/extensions/discord/src/voice/access.test.ts @@ -62,8 +62,25 @@ describe("authorizeDiscordVoiceIngress", () => { }, }); - expect(access).toMatchObject({ ok: true }); - expect(access.ok && access.channelConfig?.users).toEqual(["discord:u-owner"]); + expect(access).toEqual({ + ok: true, + channelConfig: { + allowed: true, + requireMention: undefined, + ignoreOtherMentions: undefined, + skills: undefined, + enabled: undefined, + users: ["discord:u-owner"], + roles: undefined, + systemPrompt: undefined, + includeThreadStarter: undefined, + autoThread: undefined, + autoThreadName: undefined, + autoArchiveDuration: undefined, + matchKey: "c1", + matchSource: "direct", + }, + }); }); it("allows slug-keyed guild configs when manager context only has guild name", async () => { @@ -92,7 +109,25 @@ describe("authorizeDiscordVoiceIngress", () => { }, }); - expect(access).toMatchObject({ ok: true }); + expect(access).toEqual({ + ok: true, + channelConfig: { + allowed: true, + requireMention: undefined, + ignoreOtherMentions: undefined, + skills: undefined, + enabled: undefined, + users: ["discord:u-owner"], + roles: undefined, + systemPrompt: undefined, + includeThreadStarter: undefined, + autoThread: undefined, + autoThreadName: undefined, + autoArchiveDuration: undefined, + matchKey: "*", + matchSource: "wildcard", + }, + }); }); it("allows wildcard guild configs when only the guild id is available", async () => { @@ -120,7 +155,25 @@ describe("authorizeDiscordVoiceIngress", () => { }, }); - expect(access).toMatchObject({ ok: true }); + expect(access).toEqual({ + ok: true, + channelConfig: { + allowed: true, + requireMention: undefined, + ignoreOtherMentions: undefined, + skills: undefined, + enabled: undefined, + users: ["discord:u-owner"], + roles: undefined, + systemPrompt: undefined, + includeThreadStarter: undefined, + autoThread: undefined, + autoThreadName: undefined, + autoArchiveDuration: undefined, + matchKey: "*", + matchSource: "wildcard", + }, + }); }); it("blocks commands when channel id is unavailable for an allowlisted channel", async () => { @@ -212,6 +265,24 @@ describe("authorizeDiscordVoiceIngress", () => { }, }); - expect(access).toMatchObject({ ok: true }); + expect(access).toEqual({ + ok: true, + channelConfig: { + allowed: true, + requireMention: undefined, + ignoreOtherMentions: undefined, + skills: undefined, + enabled: undefined, + users: undefined, + roles: undefined, + systemPrompt: undefined, + includeThreadStarter: undefined, + autoThread: undefined, + autoThreadName: undefined, + autoArchiveDuration: undefined, + matchKey: "c1", + matchSource: "direct", + }, + }); }); });