mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
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.
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user