惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
人人都是产品经理
人人都是产品经理
月光博客
月光博客
V
V2EX
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
博客园 - 【当耐特】
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(test): wait for telegram timer flushes · openclaw/ope...
vincentkoc · 2026-06-01 · via Recent Commits to openclaw:main
1+

import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";

12

import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

2334

const harness = await import("./bot.create-telegram-bot.test-harness.js");

@@ -197,7 +198,7 @@ describe("createTelegramBot channel_post media", () => {

197198

expect(replySpy).not.toHaveBeenCalled();

198199

await flushChannelPostMediaGroup(setTimeoutSpy);

199200200-

expect(replySpy).toHaveBeenCalledTimes(1);

201+

await vi.waitFor(() => expect(replySpy).toHaveBeenCalledTimes(1));

201202

const payload = replyPayload() as { Body?: string };

202203

expect(payload.Body).toContain("album caption");

203204

} finally {

@@ -235,7 +236,7 @@ describe("createTelegramBot channel_post media", () => {

235236

expect(replySpy).not.toHaveBeenCalled();

236237

await flushChannelPostMediaGroupForDelay(setTimeoutSpy, 75);

237238238-

expect(replySpy).toHaveBeenCalledTimes(1);

239+

await vi.waitFor(() => expect(replySpy).toHaveBeenCalledTimes(1));

239240

const payload = replyPayload() as { Body?: string };

240241

expect(payload.Body).toContain("configured album");

241242

} finally {

@@ -282,7 +283,7 @@ describe("createTelegramBot channel_post media", () => {

282283

TELEGRAM_TEST_TIMINGS.textFragmentGapMs,

283284

);

284285285-

expect(replySpy).toHaveBeenCalledTimes(1);

286+

await vi.waitFor(() => expect(replySpy).toHaveBeenCalledTimes(1));

286287

const payload = replyPayload() as { RawBody?: string };

287288

expect(payload.RawBody).toContain(part1.slice(0, 32));

288289

expect(payload.RawBody).toContain(part2.slice(0, 32));

@@ -569,7 +570,7 @@ describe("createTelegramBot channel_post media", () => {

569570

expect(replySpy).not.toHaveBeenCalled();

570571

await flushChannelPostMediaGroup(setTimeoutSpy);

571572572-

expect(replySpy).toHaveBeenCalledTimes(1);

573+

await vi.waitFor(() => expect(replySpy).toHaveBeenCalledTimes(1));

573574

const payload = replyPayload() as { Body?: string };

574575

expect(payload.Body).toContain("partial album");

575576

} finally {

@@ -582,11 +583,17 @@ describe("createTelegramBot channel_post media", () => {

582583

replySpy.mockReset();

583584

setOpenChannelPostConfig();

584585585-

const fetchSpy = createImageFetchSpy();

586-586+

const runtimeError = vi.fn();

587587

const setTimeoutSpy = vi.spyOn(globalThis, "setTimeout");

588588

try {

589-

const handler = getChannelPostHandler();

589+

createTelegramBot({

590+

token: "tok",

591+

testTimings: TELEGRAM_TEST_TIMINGS,

592+

runtime: { error: runtimeError } as unknown as RuntimeEnv,

593+

});

594+

const handler = getOnHandler("channel_post") as (

595+

ctx: Record<string, unknown>,

596+

) => Promise<void>;

590597

await queueChannelPostAlbum(handler, {

591598

caption: "fatal album",

592599

mediaGroupId: "fatal-album-1",

@@ -597,10 +604,14 @@ describe("createTelegramBot channel_post media", () => {

597604

expect(replySpy).not.toHaveBeenCalled();

598605

await flushChannelPostMediaGroup(setTimeoutSpy);

599606607+

await vi.waitFor(() =>

608+

expect(runtimeError).toHaveBeenCalledWith(

609+

expect.stringContaining("media group handler failed"),

610+

),

611+

);

600612

expect(replySpy).not.toHaveBeenCalled();

601613

} finally {

602614

setTimeoutSpy.mockRestore();

603-

fetchSpy.mockRestore();

604615

}

605616

});

606617

});