mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-02 21:01:51 +00:00
Tests: trim channels add registry imports
This commit is contained in:
@@ -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 } : {}),
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user