


























1-import { afterEach, describe, expect, it } from "vitest";
1+import { afterEach, describe, expect, it, vi } from "vitest";
22import { createEmptyPluginRegistry } from "../../plugins/registry-empty.js";
33import type { PluginRegistry } from "../../plugins/registry.js";
44import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../../plugins/runtime.js";
55import { getChannelPlugin, listChannelPlugins } from "./registry.js";
667+vi.mock("./bundled.js", () => ({
8+getBundledChannelPlugin: (id: string) =>
9+id === "fallback"
10+ ? {
11+id: "fallback",
12+meta: { label: "fallback" },
13+}
14+ : undefined,
15+}));
16+717function withMalformedChannels(registry: PluginRegistry): PluginRegistry {
818const malformed = { ...registry } as PluginRegistry;
919(malformed as { channels?: unknown }).channels = undefined;
@@ -25,11 +35,7 @@ describe("listChannelPlugins", () => {
2535it("falls back to bundled channel plugins for direct lookups before registry bootstrap", () => {
2636setActivePluginRegistry(createEmptyPluginRegistry());
273728-expect(getChannelPlugin("googlechat")?.doctor).toMatchObject({
29-dmAllowFromMode: "nestedOnly",
30-groupAllowFromFallbackToAllowFrom: false,
31-warnOnEmptyGroupSenderAllowlist: false,
32-});
38+expect(getChannelPlugin("fallback")?.meta.label).toBe("fallback");
3339});
34403541it("rebuilds channel lookups when the active registry object changes without a version bump", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。