refactor(test): dedupe gateway and web scaffolding

This commit is contained in:
Peter Steinberger
2026-02-22 20:02:05 +00:00
parent 5e8b1f5ac8
commit 2dcb244985
17 changed files with 375 additions and 498 deletions

View File

@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelOutboundAdapter, ChannelPlugin } from "../../channels/plugins/types.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
import { createMSTeamsTestPlugin, createTestRegistry } from "../../test-utils/channel-plugins.js";
import { createIMessageTestPlugin } from "../../test-utils/imessage-test-plugin.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../../utils/message-channel.js";
import { sendMessage, sendPoll } from "./message.js";
@@ -37,7 +37,7 @@ describe("sendMessage channel normalization", () => {
{
pluginId: "msteams",
source: "test",
plugin: createMSTeamsPlugin({
plugin: createMSTeamsTestPlugin({
outbound: createMSTeamsOutbound(),
aliases: ["teams"],
}),
@@ -131,7 +131,7 @@ describe("sendPoll channel normalization", () => {
{
pluginId: "msteams",
source: "test",
plugin: createMSTeamsPlugin({
plugin: createMSTeamsTestPlugin({
aliases: ["teams"],
outbound: createMSTeamsOutbound({ includePoll: true }),
}),
@@ -249,24 +249,3 @@ const createMattermostLikePlugin = (opts: {
sendMedia: async () => ({ channel: "mattermost", messageId: "m2" }),
},
});
const createMSTeamsPlugin = (params: {
aliases?: string[];
outbound: ChannelOutboundAdapter;
}): ChannelPlugin => ({
id: "msteams",
meta: {
id: "msteams",
label: "Microsoft Teams",
selectionLabel: "Microsoft Teams (Bot Framework)",
docsPath: "/channels/msteams",
blurb: "Bot Framework; enterprise support.",
aliases: params.aliases,
},
capabilities: { chatTypes: ["direct"] },
config: {
listAccountIds: () => [],
resolveAccount: () => ({}),
},
outbound: params.outbound,
});