mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 15:41:40 +00:00
refactor: move extension-owned tests to extensions
This commit is contained in:
@@ -1,12 +1,24 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import { setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { createMSTeamsTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";
|
||||
import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";
|
||||
import { resolveGatewayMessageChannel } from "./message-channel.js";
|
||||
|
||||
const emptyRegistry = createTestRegistry([]);
|
||||
const msteamsPlugin: ChannelPlugin = {
|
||||
...createMSTeamsTestPluginBase(),
|
||||
const demoAliasPlugin: ChannelPlugin = {
|
||||
...createChannelTestPluginBase({
|
||||
id: "demo-alias-channel",
|
||||
label: "Demo Alias Channel",
|
||||
docsPath: "/channels/demo-alias-channel",
|
||||
}),
|
||||
meta: {
|
||||
...createChannelTestPluginBase({
|
||||
id: "demo-alias-channel",
|
||||
label: "Demo Alias Channel",
|
||||
docsPath: "/channels/demo-alias-channel",
|
||||
}).meta,
|
||||
aliases: ["workspace-chat"],
|
||||
},
|
||||
};
|
||||
|
||||
describe("message-channel", () => {
|
||||
@@ -27,8 +39,10 @@ describe("message-channel", () => {
|
||||
|
||||
it("normalizes plugin aliases when registered", () => {
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([{ pluginId: "msteams", plugin: msteamsPlugin, source: "test" }]),
|
||||
createTestRegistry([
|
||||
{ pluginId: "demo-alias-channel", plugin: demoAliasPlugin, source: "test" },
|
||||
]),
|
||||
);
|
||||
expect(resolveGatewayMessageChannel("teams")).toBe("msteams");
|
||||
expect(resolveGatewayMessageChannel("workspace-chat")).toBe("demo-alias-channel");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user