





















@@ -22,6 +22,10 @@ const moduleLoaderParams = vi.hoisted(
2222}>,
2323);
242425+function pluginIds(plugins: ReturnType<typeof listReadOnlyChannelPluginsForConfig>): string[] {
26+return plugins.map((entry) => entry.id);
27+}
28+2529vi.mock("../../plugins/bundled-dir.js", async (importOriginal) => {
2630const actual = await importOriginal<typeof import("../../plugins/bundled-dir.js")>();
2731return {
@@ -473,7 +477,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
473477},
474478);
475479476-expect(plugins.some((entry) => entry.id === "external-chat")).toBe(false);
480+expect(pluginIds(plugins)).not.toContain("external-chat");
477481expect(fs.existsSync(setupMarker)).toBe(false);
478482expect(fs.existsSync(fullMarker)).toBe(false);
479483});
@@ -610,7 +614,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
610614},
611615);
612616613-expect(plugins.some((entry) => entry.id === "alpha-chat")).toBe(false);
617+expect(pluginIds(plugins)).not.toContain("alpha-chat");
614618const betaPlugin = plugins.find((entry) => entry.id === "beta-chat");
615619expect(betaPlugin?.meta.id).toBe("beta-chat");
616620expect(
@@ -792,7 +796,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
792796},
793797);
794798795-expect(plugins.some((entry) => entry.id === unsafeChannelId)).toBe(false);
799+expect(pluginIds(plugins)).not.toContain(unsafeChannelId);
796800expect(fs.existsSync(setupMarker)).toBe(false);
797801expect(fs.existsSync(fullMarker)).toBe(false);
798802});
@@ -907,7 +911,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
907911},
908912);
909913910-expect(plugins.some((entry) => entry.id === "external-chat")).toBe(false);
914+expect(pluginIds(plugins)).not.toContain("external-chat");
911915expect(fs.existsSync(setupMarker)).toBe(false);
912916expect(fs.existsSync(fullMarker)).toBe(false);
913917});
@@ -927,7 +931,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
927931},
928932);
929933930-expect(plugins.some((entry) => entry.id === channelId)).toBe(false);
934+expect(pluginIds(plugins)).not.toContain(channelId);
931935expect(fs.existsSync(setupMarker)).toBe(false);
932936expect(fs.existsSync(fullMarker)).toBe(false);
933937});
@@ -953,7 +957,7 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
953957},
954958);
955959956-expect(plugins.some((entry) => entry.id === channelId)).toBe(false);
960+expect(pluginIds(plugins)).not.toContain(channelId);
957961expect(fs.existsSync(setupMarker)).toBe(false);
958962expect(fs.existsSync(fullMarker)).toBe(false);
959963});
@@ -1096,8 +1100,8 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
10961100},
10971101);
109811021099-expect(plugins.some((entry) => entry.id === "spoofed-chat")).toBe(false);
1100-expect(plugins.some((entry) => entry.id === "external-chat")).toBe(false);
1103+expect(pluginIds(plugins)).not.toContain("spoofed-chat");
1104+expect(pluginIds(plugins)).not.toContain("external-chat");
11011105expect(fs.existsSync(setupMarker)).toBe(true);
11021106expect(fs.existsSync(fullMarker)).toBe(false);
11031107});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。