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

推荐订阅源

B
Blog
D
Docker
J
Java Code Geeks
腾讯CDC
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
M
MIT News - Artificial intelligence
L
LangChain Blog
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
博客园 - Franky
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
N
Netflix TechBlog - Medium
B
Blog RSS Feed
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News

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
test: dedupe telegram media e2e mock calls · openclaw/ope...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -10,6 +10,30 @@ import {

1010

watchTelegramFetch,

1111

} from "./bot.media.test-utils.js";

121213+

type ReplyPayload = { Body: string; MediaPaths?: string[] } & Record<string, unknown>;

14+15+

function replyPayload(replySpy: ReturnType<typeof vi.fn>, index = 0): ReplyPayload {

16+

const payload = replySpy.mock.calls.at(index)?.at(0);

17+

if (typeof payload !== "object" || payload === null) {

18+

throw new Error(`expected reply payload ${index}`);

19+

}

20+

return payload as ReplyPayload;

21+

}

22+23+

function downloadRequest(

24+

fetchSpy: ReturnType<typeof vi.spyOn>,

25+

index: number,

26+

): {

27+

filePathHint?: string;

28+

url?: string;

29+

} {

30+

const request = fetchSpy.mock.calls.at(index)?.at(0);

31+

if (typeof request !== "object" || request === null) {

32+

throw new Error(`expected download request ${index}`);

33+

}

34+

return request as { filePathHint?: string; url?: string };

35+

}

36+1337

describe("telegram inbound media", () => {

1438

// Parallel vitest shards can make this suite slower than the standalone run.

1539

const INBOUND_MEDIA_TEST_TIMEOUT_MS = process.platform === "win32" ? 120_000 : 90_000;

@@ -46,7 +70,7 @@ describe("telegram inbound media", () => {

4670

expect(downloadRequest?.url).toBe("https://api.telegram.org/file/bottok/photos/1.jpg");

4771

expect(downloadRequest?.filePathHint).toBe("photos/1.jpg");

4872

expect(params.replySpy).toHaveBeenCalledTimes(1);

49-

const payload = params.replySpy.mock.calls[0][0];

73+

const payload = replyPayload(params.replySpy);

5074

expect(payload.Body).toContain("<media:image>");

5175

},

5276

},

@@ -120,7 +144,7 @@ describe("telegram inbound media", () => {

120144121145

expect(runtimeError).not.toHaveBeenCalled();

122146

expect(replySpy).toHaveBeenCalledTimes(1);

123-

const payload = replySpy.mock.calls[0]?.[0] as { Body?: string; MediaPaths?: string[] };

147+

const payload = replyPayload(replySpy);

124148

expect(payload.Body).toContain("<media:image>");

125149

expect(payload.MediaPaths).toContain(inboundPath);

126150

} finally {

@@ -222,7 +246,7 @@ describe("telegram inbound media", () => {

222246

});

223247224248

expect(replySpy).toHaveBeenCalledTimes(1);

225-

const payload = replySpy.mock.calls[0][0] as Record<string, unknown>;

249+

const payload = replyPayload(replySpy);

226250

testCase.assert(payload);

227251

}

228252

});

@@ -292,8 +316,8 @@ describe("telegram media groups", () => {

292316

);

293317294318

expect(runtimeError).not.toHaveBeenCalled();

295-

const firstDownloadRequest = fetchSpy.mock.calls[0]?.[0] as { url?: string } | undefined;

296-

const secondDownloadRequest = fetchSpy.mock.calls[1]?.[0] as { url?: string } | undefined;

319+

const firstDownloadRequest = downloadRequest(fetchSpy, 0);

320+

const secondDownloadRequest = downloadRequest(fetchSpy, 1);

297321

expect(firstDownloadRequest?.url).toBe(

298322

"http://127.0.0.1:8081/custom-bot-api/file/bottok/photos/photo1.jpg",

299323

);

@@ -341,7 +365,7 @@ describe("telegram media groups", () => {

341365

],

342366

expectedReplyCount: 1,

343367

assert: (replySpy: ReturnType<typeof vi.fn>) => {

344-

const payload = replySpy.mock.calls[0]?.[0];

368+

const payload = replyPayload(replySpy);

345369

expect(payload?.Body).toContain("Here are my photos");

346370

expect(payload?.MediaPaths).toHaveLength(2);

347371

},

@@ -452,7 +476,7 @@ describe("telegram forwarded bursts", () => {

452476

});

453477454478

expect(runtimeError).not.toHaveBeenCalled();

455-

const payload = replySpy.mock.calls[0][0];

479+

const payload = replyPayload(replySpy);

456480

expect(payload.Body).toContain("Look at this");

457481

expect(payload.MediaPaths).toHaveLength(1);

458482

} finally {