mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 20:34:31 +00:00
test: dedupe shared setup in channel and doctor config tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { PluginRegistry } from "../plugins/registry.js";
|
||||
import { setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { createTestRegistry } from "../test-utils/channel-plugins.js";
|
||||
import { resolveChannelCapabilities } from "./channel-capabilities.js";
|
||||
import type { OpenClawConfig } from "./config.js";
|
||||
|
||||
@@ -86,7 +86,7 @@ describe("resolveChannelCapabilities", () => {
|
||||
|
||||
it("supports msteams capabilities", () => {
|
||||
setActivePluginRegistry(
|
||||
createRegistry([
|
||||
createTestRegistry([
|
||||
{
|
||||
pluginId: "msteams",
|
||||
source: "test",
|
||||
@@ -127,22 +127,6 @@ describe("resolveChannelCapabilities", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const createRegistry = (channels: PluginRegistry["channels"]): PluginRegistry => ({
|
||||
plugins: [],
|
||||
tools: [],
|
||||
hooks: [],
|
||||
typedHooks: [],
|
||||
commands: [],
|
||||
channels,
|
||||
providers: [],
|
||||
gatewayHandlers: {},
|
||||
httpHandlers: [],
|
||||
httpRoutes: [],
|
||||
cliRegistrars: [],
|
||||
services: [],
|
||||
diagnostics: [],
|
||||
});
|
||||
|
||||
const createStubPlugin = (id: string): ChannelPlugin => ({
|
||||
id,
|
||||
meta: {
|
||||
@@ -159,7 +143,7 @@ const createStubPlugin = (id: string): ChannelPlugin => ({
|
||||
},
|
||||
});
|
||||
|
||||
const baseRegistry = createRegistry([
|
||||
const baseRegistry = createTestRegistry([
|
||||
{ pluginId: "telegram", source: "test", plugin: createStubPlugin("telegram") },
|
||||
{ pluginId: "slack", source: "test", plugin: createStubPlugin("slack") },
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user