Tests: trim channels add registry imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-30 00:53:56 -04:00
parent 16b452040b
commit 73b128e37d

View File

@@ -2,6 +2,7 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelPluginCatalogEntry } from "../channels/plugins/catalog.js";
import type { ChannelPlugin } from "../channels/plugins/types.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js";
import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";
import {
ensureChannelSetupPluginInstalled,
@@ -13,7 +14,6 @@ import {
createMSTeamsSetupPlugin,
} from "./channels.plugin-install.test-helpers.js";
import { baseConfigSnapshot, createTestRuntime } from "./test-runtime-config-helpers.js";
import { DEFAULT_ACCOUNT_ID } from "../routing/session-key.js";
const catalogMocks = vi.hoisted(() => ({
listChannelPluginCatalogEntries: vi.fn((): ChannelPluginCatalogEntry[] => []),
@@ -96,7 +96,9 @@ function createTelegramAddTestPlugin(): ChannelPlugin {
config: {
listAccountIds: (cfg) =>
listConfiguredAccountIds(
cfg.channels?.telegram as { accounts?: Record<string, unknown>; botToken?: string } | undefined,
cfg.channels?.telegram as
| { accounts?: Record<string, unknown>; botToken?: string }
| undefined,
),
resolveAccount: resolveTelegramAccount,
},
@@ -132,9 +134,9 @@ function createTelegramAddTestPlugin(): ChannelPlugin {
...telegram,
enabled: true,
accounts: {
...(telegram.accounts ?? {}),
...telegram.accounts,
[resolvedAccountId]: {
...(telegram.accounts?.[resolvedAccountId] ?? {}),
...telegram.accounts?.[resolvedAccountId],
...(input.token ? { botToken: input.token } : {}),
},
},