mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:07:40 +00:00
test: speed up telegram suites
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, 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 {
|
||||
listNativeCommandSpecs,
|
||||
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";
|
||||
|
||||
let createTelegramBot: typeof import("./bot.js").createTelegramBot;
|
||||
let getTelegramSequentialKey: typeof import("./bot.js").getTelegramSequentialKey;
|
||||
let resetInboundDedupe: typeof import("../auto-reply/reply/inbound-dedupe.js").resetInboundDedupe;
|
||||
let replyModule: typeof import("../auto-reply/reply.js");
|
||||
const { listSkillCommandsForAgents } = vi.hoisted(() => ({
|
||||
listSkillCommandsForAgents: vi.fn(() => []),
|
||||
@@ -175,11 +174,11 @@ const getOnHandler = (event: string) => {
|
||||
|
||||
const ORIGINAL_TZ = process.env.TZ;
|
||||
describe("createTelegramBot", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
({ resetInboundDedupe } = await import("../auto-reply/reply/inbound-dedupe.js"));
|
||||
({ createTelegramBot, getTelegramSequentialKey } = await import("./bot.js"));
|
||||
beforeAll(async () => {
|
||||
replyModule = await import("../auto-reply/reply.js");
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
process.env.TZ = "UTC";
|
||||
resetInboundDedupe();
|
||||
loadConfig.mockReturnValue({
|
||||
|
||||
Reference in New Issue
Block a user