mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:50:33 +00:00
test(telegram): rewire bot harnesses to runtime seams
This commit is contained in:
@@ -5,7 +5,7 @@ import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import { escapeRegExp, formatEnvelopeTimestamp } from "../../../test/helpers/envelope-timestamp.js";
|
||||
import { withEnvAsync } from "../../../test/helpers/extensions/env.js";
|
||||
import { useFrozenTime, useRealTime } from "../../../test/helpers/extensions/frozen-time.js";
|
||||
import {
|
||||
const {
|
||||
answerCallbackQuerySpy,
|
||||
botCtorSpy,
|
||||
commandSpy,
|
||||
@@ -26,13 +26,26 @@ import {
|
||||
sequentializeSpy,
|
||||
setMessageReactionSpy,
|
||||
setMyCommandsSpy,
|
||||
telegramBotHandlersRuntimeForTest,
|
||||
telegramBotMessageDispatchRuntimeForTest,
|
||||
telegramBotNativeCommandsRuntimeForTest,
|
||||
telegramBotRuntimeForTest,
|
||||
throttlerSpy,
|
||||
useSpy,
|
||||
} from "./bot.create-telegram-bot.test-harness.js";
|
||||
} = await import("./bot.create-telegram-bot.test-harness.js");
|
||||
import { resolveTelegramFetch } from "./fetch.js";
|
||||
|
||||
// Import after the harness registers `vi.mock(...)` for grammY and Telegram internals.
|
||||
const { createTelegramBot, getTelegramSequentialKey } = await import("./bot.js");
|
||||
const { createTelegramBot, getTelegramSequentialKey, setTelegramBotRuntimeForTest } =
|
||||
await import("./bot.js");
|
||||
const { setBotHandlersRuntimeForTest } = await import("./bot-handlers.runtime.js");
|
||||
const { setBotMessageDispatchRuntimeForTest } = await import("./bot-message-dispatch.js");
|
||||
const { setBotNativeCommandsRuntimeForTest } = await import("./bot-native-commands.js");
|
||||
|
||||
setTelegramBotRuntimeForTest(telegramBotRuntimeForTest);
|
||||
setBotHandlersRuntimeForTest(telegramBotHandlersRuntimeForTest);
|
||||
setBotMessageDispatchRuntimeForTest(telegramBotMessageDispatchRuntimeForTest);
|
||||
setBotNativeCommandsRuntimeForTest(telegramBotNativeCommandsRuntimeForTest);
|
||||
|
||||
const loadConfig = getLoadConfigMock();
|
||||
const loadWebMedia = getLoadWebMediaMock();
|
||||
|
||||
Reference in New Issue
Block a user