From 2b08233a3e902bf07134bb2b39259215c7d962b6 Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Santana Date: Fri, 17 Apr 2026 13:35:25 -0400 Subject: [PATCH] Tests: mock channel registry bundled fallback Keep the registry fallback unit test on a minimal bundled fixture instead of loading the real Google Chat plugin. Doctor capability metadata remains covered by the doctor channel capability tests. --- src/channels/plugins/registry.test.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/channels/plugins/registry.test.ts b/src/channels/plugins/registry.test.ts index e7d46ebe599..105573f4fea 100644 --- a/src/channels/plugins/registry.test.ts +++ b/src/channels/plugins/registry.test.ts @@ -1,9 +1,19 @@ -import { afterEach, describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it, vi } from "vitest"; import { createEmptyPluginRegistry } from "../../plugins/registry-empty.js"; import type { PluginRegistry } from "../../plugins/registry.js"; import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../../plugins/runtime.js"; import { getChannelPlugin, listChannelPlugins } from "./registry.js"; +vi.mock("./bundled.js", () => ({ + getBundledChannelPlugin: (id: string) => + id === "fallback" + ? { + id: "fallback", + meta: { label: "fallback" }, + } + : undefined, +})); + function withMalformedChannels(registry: PluginRegistry): PluginRegistry { const malformed = { ...registry } as PluginRegistry; (malformed as { channels?: unknown }).channels = undefined; @@ -25,11 +35,7 @@ describe("listChannelPlugins", () => { it("falls back to bundled channel plugins for direct lookups before registry bootstrap", () => { setActivePluginRegistry(createEmptyPluginRegistry()); - expect(getChannelPlugin("googlechat")?.doctor).toMatchObject({ - dmAllowFromMode: "nestedOnly", - groupAllowFromFallbackToAllowFrom: false, - warnOnEmptyGroupSenderAllowlist: false, - }); + expect(getChannelPlugin("fallback")?.meta.label).toBe("fallback"); }); it("rebuilds channel lookups when the active registry object changes without a version bump", () => {