refactor(test): reduce auth and channel setup duplication

This commit is contained in:
Peter Steinberger
2026-02-16 16:02:18 +00:00
parent 9adcaccd0b
commit def3a3ced1
4 changed files with 59 additions and 107 deletions

View File

@@ -1,12 +1,5 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { discordPlugin } from "../../extensions/discord/src/channel.js";
import { imessagePlugin } from "../../extensions/imessage/src/channel.js";
import { signalPlugin } from "../../extensions/signal/src/channel.js";
import { slackPlugin } from "../../extensions/slack/src/channel.js";
import { telegramPlugin } from "../../extensions/telegram/src/channel.js";
import { whatsappPlugin } from "../../extensions/whatsapp/src/channel.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { createTestRegistry } from "../test-utils/channel-plugins.js";
import { setDefaultChannelPluginRegistryForTests } from "./channel-test-helpers.js";
import { baseConfigSnapshot, createTestRuntime } from "./test-runtime-config-helpers.js";
const configMocks = vi.hoisted(() => ({
@@ -56,16 +49,7 @@ describe("channels command", () => {
version: 1,
profiles: {},
});
setActivePluginRegistry(
createTestRegistry([
{ pluginId: "discord", plugin: discordPlugin, source: "test" },
{ pluginId: "slack", plugin: slackPlugin, source: "test" },
{ pluginId: "telegram", plugin: telegramPlugin, source: "test" },
{ pluginId: "whatsapp", plugin: whatsappPlugin, source: "test" },
{ pluginId: "signal", plugin: signalPlugin, source: "test" },
{ pluginId: "imessage", plugin: imessagePlugin, source: "test" },
]),
);
setDefaultChannelPluginRegistryForTests();
});
it("adds a non-default telegram account", async () => {