From 3871b5a238be883ae0ec9b9f197930cbeea63a73 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Feb 2026 02:34:28 +0000 Subject: [PATCH] perf(test): remove dead telegram bot test scaffolding --- src/telegram/bot.test.ts | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/telegram/bot.test.ts b/src/telegram/bot.test.ts index 2e4ffa338e..d8cf574673 100644 --- a/src/telegram/bot.test.ts +++ b/src/telegram/bot.test.ts @@ -1,7 +1,4 @@ -import fs from "node:fs"; -import os from "node:os"; -import path from "node:path"; -import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { escapeRegExp, formatEnvelopeTimestamp } from "../../test/helpers/envelope-timestamp.js"; import { expectInboundContextContract } from "../../test/helpers/inbound-contract.js"; import { @@ -9,8 +6,7 @@ import { listNativeCommandSpecsForConfig, } from "../auto-reply/commands-registry.js"; import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js"; -import { createTelegramBot, getTelegramSequentialKey } from "./bot.js"; -import { resolveTelegramFetch } from "./fetch.js"; +import { createTelegramBot } from "./bot.js"; let replyModule: typeof import("../auto-reply/reply.js"); const { listSkillCommandsForAgents } = vi.hoisted(() => ({ @@ -23,13 +19,6 @@ vi.mock("../auto-reply/skill-commands.js", () => ({ const { sessionStorePath } = vi.hoisted(() => ({ sessionStorePath: `/tmp/openclaw-telegram-bot-${Math.random().toString(16).slice(2)}.json`, })); -const tempDirs: string[] = []; - -function createTempDir(prefix: string): string { - const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix)); - tempDirs.push(dir); - return dir; -} function resolveSkillCommands(config: Parameters[0]) { return listSkillCommandsForAgents({ cfg: config }); @@ -149,10 +138,8 @@ vi.mock("grammy", () => ({ const sequentializeMiddleware = vi.fn(); const sequentializeSpy = vi.fn(() => sequentializeMiddleware); -let sequentializeKey: ((ctx: unknown) => string) | undefined; vi.mock("@grammyjs/runner", () => ({ - sequentialize: (keyFn: (ctx: unknown) => string) => { - sequentializeKey = keyFn; + sequentialize: (_keyFn: (ctx: unknown) => string) => { return sequentializeSpy(); }, })); @@ -209,19 +196,11 @@ describe("createTelegramBot", () => { middlewareUseSpy.mockReset(); sequentializeSpy.mockReset(); botCtorSpy.mockReset(); - sequentializeKey = undefined; }); afterEach(() => { process.env.TZ = ORIGINAL_TZ; }); - afterAll(() => { - for (const dir of tempDirs) { - fs.rmSync(dir, { recursive: true, force: true }); - } - tempDirs.length = 0; - }); - it("merges custom commands with native commands", () => { const config = { channels: {