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

推荐订阅源

N
News and Events Feed by Topic
V
V2EX
博客园 - 【当耐特】
Vercel News
Vercel News
雷峰网
雷峰网
爱范儿
爱范儿
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
NISL@THU
NISL@THU
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
P
Proofpoint News Feed
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
K
Kaspersky official blog
I
InfoQ
Google Online Security Blog
Google Online Security Blog
L
LINUX DO - 最新话题
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
V
Visual Studio Blog
AI
AI
Schneier on Security
Schneier on Security
B
Blog RSS Feed
T
Tor Project blog
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Cyber Attacks, Cyber Crime and Cyber Security
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
V2EX - 技术
V2EX - 技术
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
Arctic Wolf
Webroot Blog
Webroot Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main

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: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311 test: trim remaining hotspot tests · openclaw/openclaw@6ba8626 test: narrow hotspot mocks · openclaw/openclaw@dbc8179 test: isolate gemini embedding request helpers · openclaw/openclaw@cd330f5 test: trim memory and mcp hotspots · openclaw/openclaw@fd48dfa test: slim provider registry mocks · openclaw/openclaw@2e08c77 test: harden Parallels update smoke · openclaw/openclaw@1a98090 feat: default Anthropic to Opus 4.7 · openclaw/openclaw@628b454 fix: harden node-host shell payload mutability checks · openclaw/openclaw@75c551e fix: land node-host approval binding for native binaries (#66731) (th… · openclaw/openclaw@29919bb CI: add daily schedule to CodeQL workflow (#67645) · openclaw/openclaw@69d25f5 fix(gateway): capture config hash after plugin auto-enable to prevent… · openclaw/openclaw@8c11210 fix: repair sanitized replay tool results before send (#67620) (thank… · openclaw/openclaw@c3c7a99 fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6 fix: keep TUI watchdog bound to active run (#67401) (thanks @xantorres) · openclaw/openclaw@3525273 Gateway/skills: dedupe skills prefix-match + drop dead fallback on log · openclaw/openclaw@d7f489f Extensions/lmstudio: back off inference preload after consecutive fai… · openclaw/openclaw@b555214 TUI/streaming: add watchdog that resets the activity indicator after … · openclaw/openclaw@f44ab20 Agents/tool-loop: enable unknown-tool stream guard by default · openclaw/openclaw@36ed367 Gateway/skills: invalidate session skills snapshot on config write · openclaw/openclaw@b23d59a fix: classify HTML provider error pages correctly (#67642) (thanks @s… · openclaw/openclaw@e588e90 fix(skills): remove unused model-usage import (#67641) · openclaw/openclaw@55f05df docs(changelog): credit codex fix superseded PRs · openclaw/openclaw@e485f24 fix(openai-codex): normalize stale transport metadata in resolution a… · openclaw/openclaw@90801ba CI: pin Docker-related GitHub Actions (#67632) · openclaw/openclaw@f697b01 Android: modernize WebView and discovery API usage (#67627) · openclaw/openclaw@44a6e50 fix(deps): bump hono to 4.12.14 and @hono/node-server to 1.19.14 (GHS… · openclaw/openclaw@fbccc18 fix(deps): bump dompurify to 3.4.0 (#67614) · openclaw/openclaw@2c2dc00 CI: add explicit permissions to all workflow jobs (fixes code-scannin… · openclaw/openclaw@01b7516 fix: register bundled TTS providers and route overrides correctly (#6… · openclaw/openclaw@6ea3cdd fix: align host tilde paths with OS home (#62804) (thanks @stainlu) · openclaw/openclaw@ecfaf64 fix: flush creds queue before reconnect socket open (#67464) (thanks … · openclaw/openclaw@405c63f fix: strip standalone <function> tool call tags from visible text (#6… · openclaw/openclaw@78df859 fix(agents): preserve cli session metadata before transcript persist … · openclaw/openclaw@898fd04 docs(changelog): move cli transcript entry · openclaw/openclaw@c1817c6 fix(agents): normalize cli transcript api field · openclaw/openclaw@3a3fae0 docs(changelog): note cli transcript persistence · openclaw/openclaw@6c343f1 fix(agents): persist cli transcript turns · openclaw/openclaw@b8ef507 fix(msteams): harden security-sensitive flows (#65841) · openclaw/openclaw@c56b56e [Dashboard] Fix exec approval modal overflow for long command content… · openclaw/openclaw@053c5b0 Docs: remove QA changelog entry · openclaw/openclaw@7fd5771 QA: fix private runtime source loading (#67428) · openclaw/openclaw@d5933af docs(gateway): correct protocol.md schema path, hello-ok example, aut… · openclaw/openclaw@489404d CI: pin Node 22 runners to 22.18.0 · openclaw/openclaw@4ffa621 models.authStatus: normalize provider ids + tighten env-backed escape… · openclaw/openclaw@f2fdb9d Update CHANGELOG.md · openclaw/openclaw@7694a92 test(parallels): clean up npm update guard jobs · openclaw/openclaw@045ea7b Plugins: prefer scanDir override paths · openclaw/openclaw@b2974da fix(dreaming): default storage.mode to "separate" so phase blocks sto… · openclaw/openclaw@8c392f0 fix(memory-core): skip dreaming transcript ingestion via session stor… · openclaw/openclaw@a1b01f0 fix: dedupe replayed exec.finished node events (#67281) · openclaw/openclaw@5dcf526
test: guard telegram delivery mock calls · openclaw/openclaw@4bc47a3
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -114,7 +114,7 @@ function expectRecordFields(record: unknown, expected: Record<string, unknown>)

114114

}

115115116116

function mockCallArg(mock: ReturnType<typeof vi.fn>, callIndex: number, argIndex: number) {

117-

const call = mock.mock.calls[callIndex];

117+

const call = mock.mock.calls.at(callIndex);

118118

if (!call) {

119119

throw new Error(`Expected mock call ${callIndex}`);

120120

}

@@ -229,7 +229,7 @@ describe("deliverReplies", () => {

229229230230

expect(runtime.error).toHaveBeenCalledTimes(1);

231231

expect(sendMessage).toHaveBeenCalledTimes(1);

232-

expect(sendMessage.mock.calls[0]?.[1]).toBe("hello");

232+

expect(sendMessage.mock.calls.at(0)?.[1]).toBe("hello");

233233

});

234234235235

it("mirrors delivered replies once after successful sends", async () => {

@@ -276,8 +276,8 @@ describe("deliverReplies", () => {

276276

bot,

277277

});

278278279-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

280-

expect(sendMessage.mock.calls[0]?.[1]).toBe("Plugin bind approval required");

279+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

280+

expect(sendMessage.mock.calls.at(0)?.[1]).toBe("Plugin bind approval required");

281281

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

282282

reply_markup: {

283283

inline_keyboard: [

@@ -309,8 +309,8 @@ describe("deliverReplies", () => {

309309

});

310310311311

expect(runtime.error).not.toHaveBeenCalled();

312-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

313-

expect(sendMessage.mock.calls[0]?.[1]).toContain("Retry");

312+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

313+

expect(sendMessage.mock.calls.at(0)?.[1]).toContain("Retry");

314314

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

315315

reply_markup: {

316316

inline_keyboard: [[{ text: "Retry", callback_data: "cmd:retry" }]],

@@ -392,8 +392,8 @@ describe("deliverReplies", () => {

392392

silent: true,

393393

});

394394395-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

396-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

395+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

396+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

397397

expectRecordFields(mockCallArg(sendMessage, 0, 2), { disable_notification: true });

398398

});

399399

@@ -455,9 +455,9 @@ describe("deliverReplies", () => {

455455

});

456456457457

expect(sendMessage).toHaveBeenCalledTimes(1);

458-

expect(sendMessage.mock.calls[0]?.[1]).toBeTypeOf("string");

459-

expect(sendMessage.mock.calls[0]?.[1]).not.toBe("");

460-

expect(sendMessage.mock.calls[0]?.[1]?.trim()).not.toBe("NO_REPLY");

458+

expect(sendMessage.mock.calls.at(0)?.[1]).toBeTypeOf("string");

459+

expect(sendMessage.mock.calls.at(0)?.[1]).not.toBe("");

460+

expect(sendMessage.mock.calls.at(0)?.[1]?.trim()).not.toBe("NO_REPLY");

461461

});

462462463463

it("uses the policy session key for exact NO_REPLY policy", async () => {

@@ -474,9 +474,9 @@ describe("deliverReplies", () => {

474474

});

475475476476

expect(sendMessage).toHaveBeenCalledTimes(1);

477-

expect(sendMessage.mock.calls[0]?.[1]).toBeTypeOf("string");

478-

expect(sendMessage.mock.calls[0]?.[1]).not.toBe("");

479-

expect(sendMessage.mock.calls[0]?.[1]?.trim()).not.toBe("NO_REPLY");

477+

expect(sendMessage.mock.calls.at(0)?.[1]).toBeTypeOf("string");

478+

expect(sendMessage.mock.calls.at(0)?.[1]).not.toBe("");

479+

expect(sendMessage.mock.calls.at(0)?.[1]?.trim()).not.toBe("NO_REPLY");

480480

});

481481482482

it("suppresses exact NO_REPLY for group Telegram sessions", async () => {

@@ -631,8 +631,8 @@ describe("deliverReplies", () => {

631631

bot,

632632

});

633633634-

expect(sendPhoto.mock.calls[0]?.[0]).toBe("123");

635-

if (sendPhoto.mock.calls[0]?.[1] === undefined) {

634+

expect(sendPhoto.mock.calls.at(0)?.[0]).toBe("123");

635+

if (sendPhoto.mock.calls.at(0)?.[1] === undefined) {

636636

throw new Error("Expected Telegram photo media");

637637

}

638638

expectRecordFields(mockCallArg(sendPhoto, 0, 2), {

@@ -659,8 +659,8 @@ describe("deliverReplies", () => {

659659

});

660660661661

expect(probeVideoDimensions).toHaveBeenCalledWith(Buffer.from("video"));

662-

expect(sendVideo.mock.calls[0]?.[0]).toBe("123");

663-

if (sendVideo.mock.calls[0]?.[1] === undefined) {

662+

expect(sendVideo.mock.calls.at(0)?.[0]).toBe("123");

663+

if (sendVideo.mock.calls.at(0)?.[1] === undefined) {

664664

throw new Error("Expected Telegram video media");

665665

}

666666

expectRecordFields(mockCallArg(sendVideo, 0, 2), {

@@ -688,8 +688,8 @@ describe("deliverReplies", () => {

688688

});

689689690690

expect(probeVideoDimensions).not.toHaveBeenCalled();

691-

expect(sendAnimation.mock.calls[0]?.[0]).toBe("123");

692-

if (sendAnimation.mock.calls[0]?.[1] === undefined) {

691+

expect(sendAnimation.mock.calls.at(0)?.[0]).toBe("123");

692+

if (sendAnimation.mock.calls.at(0)?.[1] === undefined) {

693693

throw new Error("Expected Telegram animation media");

694694

}

695695

const options = mockCallArg(sendAnimation, 0, 2) as Record<string, unknown>;

@@ -735,8 +735,8 @@ describe("deliverReplies", () => {

735735

linkPreview: false,

736736

});

737737738-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

739-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

738+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

739+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

740740

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

741741

link_preview_options: { is_disabled: true },

742742

});

@@ -752,8 +752,8 @@ describe("deliverReplies", () => {

752752

thread: { id: 42, scope: "dm" },

753753

});

754754755-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

756-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

755+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

756+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

757757

expectRecordFields(mockCallArg(sendMessage, 0, 2), { message_thread_id: 42 });

758758

});

759759

@@ -772,7 +772,7 @@ describe("deliverReplies", () => {

772772

).rejects.toThrow("message thread not found");

773773774774

expect(sendMessage).toHaveBeenCalledTimes(1);

775-

expectRecordFields(sendMessage.mock.calls[0]?.[2], { message_thread_id: 42 });

775+

expectRecordFields(mockCallArg(sendMessage, 0, 2), { message_thread_id: 42 });

776776

expect(runtime.error).toHaveBeenCalledTimes(1);

777777

});

778778

@@ -853,7 +853,7 @@ describe("deliverReplies", () => {

853853

).rejects.toThrow("message thread not found");

854854855855

expect(sendPhoto).toHaveBeenCalledTimes(1);

856-

expectRecordFields(sendPhoto.mock.calls[0]?.[2], { message_thread_id: 42 });

856+

expectRecordFields(mockCallArg(sendPhoto, 0, 2), { message_thread_id: 42 });

857857

expect(runtime.error).toHaveBeenCalledTimes(1);

858858

});

859859

@@ -867,9 +867,9 @@ describe("deliverReplies", () => {

867867

linkPreview: true,

868868

});

869869870-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

871-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

872-

expect(sendMessage.mock.calls[0]?.[2]).not.toHaveProperty("link_preview_options");

870+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

871+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

872+

expect(mockCallArg(sendMessage, 0, 2)).not.toHaveProperty("link_preview_options");

873873

});

874874875875

it("falls back to plain text when markdown renders to empty HTML in threaded mode", async () => {

@@ -897,9 +897,9 @@ describe("deliverReplies", () => {

897897

});

898898899899

expect(sendMessage).toHaveBeenCalledTimes(1);

900-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

901-

expect(sendMessage.mock.calls[0]?.[1]).toBe(">");

902-

expectRecordFields(sendMessage.mock.calls[0]?.[2], { message_thread_id: 42 });

900+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

901+

expect(sendMessage.mock.calls.at(0)?.[1]).toBe(">");

902+

expectRecordFields(mockCallArg(sendMessage, 0, 2), { message_thread_id: 42 });

903903

});

904904905905

it("skips whitespace-only text replies without calling Telegram", async () => {

@@ -940,9 +940,9 @@ describe("deliverReplies", () => {

940940

replyQuoteEntities: [{ type: "bold", offset: 0, length: 6 }],

941941

});

942942943-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

944-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

945-

expectRecordFields(sendMessage.mock.calls[0]?.[2], {

943+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

944+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

945+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

946946

reply_parameters: {

947947

message_id: 500,

948948

quote: " quoted text\n",

@@ -951,7 +951,7 @@ describe("deliverReplies", () => {

951951

allow_sending_without_reply: true,

952952

},

953953

});

954-

expect(sendMessage.mock.calls[0]?.[2]).not.toHaveProperty("reply_to_message_id");

954+

expect(mockCallArg(sendMessage, 0, 2)).not.toHaveProperty("reply_to_message_id");

955955

});

956956957957

it("uses the native quote candidate that matches each reply target", async () => {

@@ -976,15 +976,15 @@ describe("deliverReplies", () => {

976976

},

977977

});

978978979-

expectRecordFields(sendMessage.mock.calls[0]?.[2], {

979+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

980980

reply_parameters: {

981981

message_id: 500,

982982

quote: "first quote",

983983

quote_position: 0,

984984

allow_sending_without_reply: true,

985985

},

986986

});

987-

expectRecordFields(sendMessage.mock.calls[1]?.[2], {

987+

expectRecordFields(mockCallArg(sendMessage, 1, 2), {

988988

reply_parameters: {

989989

message_id: 501,

990990

quote: "second quote",

@@ -1020,18 +1020,18 @@ describe("deliverReplies", () => {

10201020

});

1021102110221022

expect(sendMessage).toHaveBeenCalledTimes(2);

1023-

expectRecordFields(sendMessage.mock.calls[0][2], {

1023+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

10241024

reply_parameters: {

10251025

message_id: 500,

10261026

quote: " quoted text\n",

10271027

allow_sending_without_reply: true,

10281028

},

10291029

});

1030-

expectRecordFields(sendMessage.mock.calls[1][2], {

1030+

expectRecordFields(mockCallArg(sendMessage, 1, 2), {

10311031

reply_to_message_id: 500,

10321032

allow_sending_without_reply: true,

10331033

});

1034-

expect(sendMessage.mock.calls[1][2]).not.toHaveProperty("reply_parameters");

1034+

expect(mockCallArg(sendMessage, 1, 2)).not.toHaveProperty("reply_parameters");

10351035

}

10361036

});

10371037

@@ -1052,13 +1052,13 @@ describe("deliverReplies", () => {

10521052

replyQuoteText: "quoted text",

10531053

});

105410541055-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

1056-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

1057-

expectRecordFields(sendMessage.mock.calls[0]?.[2], {

1055+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

1056+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

1057+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

10581058

reply_to_message_id: 501,

10591059

allow_sending_without_reply: true,

10601060

});

1061-

expect(sendMessage.mock.calls[0][2]).not.toHaveProperty("reply_parameters");

1061+

expect(mockCallArg(sendMessage, 0, 2)).not.toHaveProperty("reply_parameters");

10621062

});

1063106310641064

it("omits native quote parameters when reply mode suppresses the reply", async () => {

@@ -1078,8 +1078,8 @@ describe("deliverReplies", () => {

10781078

replyQuoteText: "quoted text",

10791079

});

108010801081-

expect(sendMessage.mock.calls[0][2]).not.toHaveProperty("reply_parameters");

1082-

expect(sendMessage.mock.calls[0][2]).not.toHaveProperty("reply_to_message_id");

1081+

expect(mockCallArg(sendMessage, 0, 2)).not.toHaveProperty("reply_parameters");

1082+

expect(mockCallArg(sendMessage, 0, 2)).not.toHaveProperty("reply_to_message_id");

10831083

});

1084108410851085

it("uses legacy reply id when quote text has no quoted message id", async () => {

@@ -1098,13 +1098,13 @@ describe("deliverReplies", () => {

10981098

replyQuoteText: "quoted text",

10991099

});

110011001101-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

1102-

expect(typeof sendMessage.mock.calls[0]?.[1]).toBe("string");

1103-

expectRecordFields(sendMessage.mock.calls[0]?.[2], {

1101+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

1102+

expect(typeof sendMessage.mock.calls.at(0)?.[1]).toBe("string");

1103+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

11041104

reply_to_message_id: 501,

11051105

allow_sending_without_reply: true,

11061106

});

1107-

expect(sendMessage.mock.calls[0][2]).not.toHaveProperty("reply_parameters");

1107+

expect(mockCallArg(sendMessage, 0, 2)).not.toHaveProperty("reply_parameters");

11081108

});

1109110911101110

it("falls back to text when sendVoice fails with VOICE_MESSAGES_FORBIDDEN", async () => {

@@ -1130,9 +1130,9 @@ describe("deliverReplies", () => {

11301130

expect(sendVoice).toHaveBeenCalledTimes(1);

11311131

// Fallback to text succeeded

11321132

expect(sendMessage).toHaveBeenCalledTimes(1);

1133-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

1134-

expect(sendMessage.mock.calls[0]?.[1]).toContain("Hello there");

1135-

if (sendMessage.mock.calls[0]?.[2] === undefined) {

1133+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

1134+

expect(sendMessage.mock.calls.at(0)?.[1]).toContain("Hello there");

1135+

if (sendMessage.mock.calls.at(0)?.[2] === undefined) {

11361136

throw new Error("Expected Telegram fallback text options");

11371137

}

11381138

});

@@ -1158,9 +1158,9 @@ describe("deliverReplies", () => {

11581158

});

1159115911601160

expect(sendVoice).toHaveBeenCalledTimes(1);

1161-

expect(sendMessage.mock.calls[0]?.[0]).toBe("123");

1162-

expect(sendMessage.mock.calls[0]?.[1]).toContain("Hello there");

1163-

expectRecordFields(sendMessage.mock.calls[0]?.[2], { disable_notification: true });

1161+

expect(sendMessage.mock.calls.at(0)?.[0]).toBe("123");

1162+

expect(sendMessage.mock.calls.at(0)?.[1]).toContain("Hello there");

1163+

expectRecordFields(mockCallArg(sendMessage, 0, 2), { disable_notification: true });

11641164

});

1165116511661166

it("voice fallback applies reply-to only on first chunk when replyToMode is first", async () => {

@@ -1198,7 +1198,7 @@ describe("deliverReplies", () => {

1198119811991199

expect(sendVoice).toHaveBeenCalledTimes(1);

12001200

expect(sendMessage.mock.calls.length).toBeGreaterThanOrEqual(2);

1201-

expectRecordFields(sendMessage.mock.calls[0][2], {

1201+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

12021202

reply_parameters: {

12031203

message_id: 77,

12041204

quote: "quoted context",

@@ -1208,9 +1208,9 @@ describe("deliverReplies", () => {

12081208

inline_keyboard: [[{ text: "Ack", callback_data: "ack" }]],

12091209

},

12101210

});

1211-

expect(sendMessage.mock.calls[1][2]).not.toHaveProperty("reply_to_message_id", 77);

1212-

expect(sendMessage.mock.calls[1][2]).not.toHaveProperty("reply_parameters");

1213-

expect(sendMessage.mock.calls[1][2]).not.toHaveProperty("reply_markup");

1211+

expect(mockCallArg(sendMessage, 1, 2)).not.toHaveProperty("reply_to_message_id", 77);

1212+

expect(mockCallArg(sendMessage, 1, 2)).not.toHaveProperty("reply_parameters");

1213+

expect(mockCallArg(sendMessage, 1, 2)).not.toHaveProperty("reply_markup");

12141214

});

1215121512161216

it("rethrows non-VOICE_MESSAGES_FORBIDDEN errors from sendVoice", async () => {

@@ -1255,12 +1255,12 @@ describe("deliverReplies", () => {

1255125512561256

expect(sendMessage.mock.calls.length).toBeGreaterThanOrEqual(2);

12571257

// First chunk should have reply_to_message_id

1258-

expectRecordFields(sendMessage.mock.calls[0][2], {

1258+

expectRecordFields(mockCallArg(sendMessage, 0, 2), {

12591259

reply_to_message_id: 700,

12601260

allow_sending_without_reply: true,

12611261

});

12621262

// Second chunk should NOT have reply_to_message_id

1263-

expect(sendMessage.mock.calls[1][2]).not.toHaveProperty("reply_to_message_id");

1263+

expect(mockCallArg(sendMessage, 1, 2)).not.toHaveProperty("reply_to_message_id");

12641264

});

1265126512661266

it("replyToMode 'all' applies reply-to to every text chunk", async () => {

@@ -1314,12 +1314,12 @@ describe("deliverReplies", () => {

1314131413151315

expect(sendPhoto).toHaveBeenCalledTimes(2);

13161316

// First media should have reply_to_message_id

1317-

expectRecordFields(sendPhoto.mock.calls[0][2], {

1317+

expectRecordFields(mockCallArg(sendPhoto, 0, 2), {

13181318

reply_to_message_id: 900,

13191319

allow_sending_without_reply: true,

13201320

});

13211321

// Second media should NOT have reply_to_message_id

1322-

expect(sendPhoto.mock.calls[1][2]).not.toHaveProperty("reply_to_message_id");

1322+

expect(mockCallArg(sendPhoto, 1, 2)).not.toHaveProperty("reply_to_message_id");

13231323

});

1324132413251325

it("pins the first delivered text message when telegram pin is requested", async () => {