From c2b2a4cdf4a9874a298779441e02cf6f0a88f940 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 8 May 2026 11:26:01 +0100 Subject: [PATCH] test: clarify read only channel plugin assertions --- src/channels/plugins/read-only.test.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/channels/plugins/read-only.test.ts b/src/channels/plugins/read-only.test.ts index 7fc2bced245..73531190179 100644 --- a/src/channels/plugins/read-only.test.ts +++ b/src/channels/plugins/read-only.test.ts @@ -22,6 +22,10 @@ const moduleLoaderParams = vi.hoisted( }>, ); +function pluginIds(plugins: ReturnType): string[] { + return plugins.map((entry) => entry.id); +} + vi.mock("../../plugins/bundled-dir.js", async (importOriginal) => { const actual = await importOriginal(); return { @@ -473,7 +477,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === "external-chat")).toBe(false); + expect(pluginIds(plugins)).not.toContain("external-chat"); expect(fs.existsSync(setupMarker)).toBe(false); expect(fs.existsSync(fullMarker)).toBe(false); }); @@ -610,7 +614,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === "alpha-chat")).toBe(false); + expect(pluginIds(plugins)).not.toContain("alpha-chat"); const betaPlugin = plugins.find((entry) => entry.id === "beta-chat"); expect(betaPlugin?.meta.id).toBe("beta-chat"); expect( @@ -792,7 +796,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === unsafeChannelId)).toBe(false); + expect(pluginIds(plugins)).not.toContain(unsafeChannelId); expect(fs.existsSync(setupMarker)).toBe(false); expect(fs.existsSync(fullMarker)).toBe(false); }); @@ -907,7 +911,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === "external-chat")).toBe(false); + expect(pluginIds(plugins)).not.toContain("external-chat"); expect(fs.existsSync(setupMarker)).toBe(false); expect(fs.existsSync(fullMarker)).toBe(false); }); @@ -927,7 +931,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === channelId)).toBe(false); + expect(pluginIds(plugins)).not.toContain(channelId); expect(fs.existsSync(setupMarker)).toBe(false); expect(fs.existsSync(fullMarker)).toBe(false); }); @@ -953,7 +957,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === channelId)).toBe(false); + expect(pluginIds(plugins)).not.toContain(channelId); expect(fs.existsSync(setupMarker)).toBe(false); expect(fs.existsSync(fullMarker)).toBe(false); }); @@ -1096,8 +1100,8 @@ describe("listReadOnlyChannelPluginsForConfig", () => { }, ); - expect(plugins.some((entry) => entry.id === "spoofed-chat")).toBe(false); - expect(plugins.some((entry) => entry.id === "external-chat")).toBe(false); + expect(pluginIds(plugins)).not.toContain("spoofed-chat"); + expect(pluginIds(plugins)).not.toContain("external-chat"); expect(fs.existsSync(setupMarker)).toBe(true); expect(fs.existsSync(fullMarker)).toBe(false); });