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

推荐订阅源

D
Docker
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Check Point Blog
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园_首页
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
T
The Blog of Author Tim Ferriss
The Cloudflare Blog

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: fix message delivery contract assertions · openclaw...
shakkernerd · 2026-05-09 · via Recent Commits to openclaw:main

@@ -3,30 +3,22 @@ import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";

33

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

44

import type { RequestClient } from "../internal/discord.js";

556-

const deliverOutboundPayloadsMock = vi.hoisted(() =>

7-

vi.fn(async () => [{ messageId: "msg-1", channelId: "channel-1" }]),

6+

const sendDurableMessageBatchMock = vi.hoisted(() =>

7+

vi.fn(async () => ({

8+

status: "sent" as const,

9+

results: [{ messageId: "msg-1", channelId: "channel-1" }],

10+

})),

811

);

912

const sendMessageDiscordMock = vi.hoisted(() => vi.fn());

1013

const sendVoiceMessageDiscordMock = vi.hoisted(() => vi.fn());

111412-

vi.mock("openclaw/plugin-sdk/outbound-runtime", async () => {

13-

const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/outbound-runtime")>(

14-

"openclaw/plugin-sdk/outbound-runtime",

15+

vi.mock("openclaw/plugin-sdk/channel-message", async () => {

16+

const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/channel-message")>(

17+

"openclaw/plugin-sdk/channel-message",

1518

);

1619

return {

1720

...actual,

18-

deliverOutboundPayloads: deliverOutboundPayloadsMock,

19-

};

20-

});

21-22-

vi.mock("../../../../src/infra/outbound/deliver.js", async () => {

23-

const actual = await vi.importActual<typeof import("../../../../src/infra/outbound/deliver.js")>(

24-

"../../../../src/infra/outbound/deliver.js",

25-

);

26-

return {

27-

...actual,

28-

deliverOutboundPayloads: deliverOutboundPayloadsMock,

29-

deliverOutboundPayloadsInternal: deliverOutboundPayloadsMock,

21+

sendDurableMessageBatch: sendDurableMessageBatchMock,

3022

};

3123

});

3224

@@ -42,7 +34,7 @@ vi.mock("../send.js", async () => {

4234

let deliverDiscordReply: typeof import("./reply-delivery.js").deliverDiscordReply;

43354436

function firstDeliverParams() {

45-

const calls = deliverOutboundPayloadsMock.mock.calls as unknown as Array<

37+

const calls = sendDurableMessageBatchMock.mock.calls as unknown as Array<

4638

[

4739

{

4840

cfg?: OpenClawConfig;

@@ -53,7 +45,7 @@ function firstDeliverParams() {

5345

>;

5446

const params = calls[0]?.[0];

5547

if (!params) {

56-

throw new Error("deliverOutboundPayloads was not called");

48+

throw new Error("sendDurableMessageBatch was not called");

5749

}

5850

return params;

5951

}

@@ -69,8 +61,11 @@ describe("deliverDiscordReply", () => {

6961

});

70627163

beforeEach(() => {

72-

deliverOutboundPayloadsMock.mockClear();

73-

deliverOutboundPayloadsMock.mockResolvedValue([{ messageId: "msg-1", channelId: "channel-1" }]);

64+

sendDurableMessageBatchMock.mockClear();

65+

sendDurableMessageBatchMock.mockResolvedValue({

66+

status: "sent",

67+

results: [{ messageId: "msg-1", channelId: "channel-1" }],

68+

});

7469

sendMessageDiscordMock.mockReset().mockResolvedValue({

7570

messageId: "msg-1",

7671

channelId: "channel-1",

@@ -98,7 +93,7 @@ describe("deliverDiscordReply", () => {

9893

replyToMode: "all",

9994

});

10095101-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

96+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

10297

expect.objectContaining({

10398

channel: "discord",

10499

to: "channel:101",

@@ -119,7 +114,7 @@ describe("deliverDiscordReply", () => {

119114

});

120115121116

it("fails when shared outbound accepts a final reply but delivers no Discord message", async () => {

122-

deliverOutboundPayloadsMock.mockResolvedValueOnce([]);

117+

sendDurableMessageBatchMock.mockResolvedValueOnce({ status: "sent", results: [] });

123118124119

await expect(

125120

deliverDiscordReply({

@@ -154,7 +149,7 @@ describe("deliverDiscordReply", () => {

154149

textLimit: 2000,

155150

});

156151157-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

152+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

158153

expect.objectContaining({

159154

payloads: [{ text: "Visible reply." }],

160155

}),

@@ -177,7 +172,7 @@ describe("deliverDiscordReply", () => {

177172

textLimit: 2000,

178173

});

179174180-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

175+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

181176

expect.objectContaining({

182177

payloads: [{ mediaUrl: "https://example.com/result.png", text: undefined }],

183178

}),

@@ -218,7 +213,7 @@ describe("deliverDiscordReply", () => {

218213

textLimit: 2000,

219214

});

220215221-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

216+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

222217

expect.objectContaining({

223218

payloads: [{ channelData, text: undefined }],

224219

}),

@@ -251,7 +246,7 @@ describe("deliverDiscordReply", () => {

251246

textLimit: 2000,

252247

});

253248254-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

249+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

255250

expect.objectContaining({

256251

payloads: [{ presentation, text: undefined }],

257252

}),

@@ -271,7 +266,7 @@ describe("deliverDiscordReply", () => {

271266

textLimit: 2000,

272267

});

273268274-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

269+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

275270

expect.objectContaining({

276271

payloads: [{ text }],

277272

}),

@@ -296,7 +291,7 @@ describe("deliverDiscordReply", () => {

296291

textLimit: 2000,

297292

});

298293299-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

294+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

300295

expect.objectContaining({

301296

payloads: [{ text }],

302297

}),

@@ -362,7 +357,7 @@ describe("deliverDiscordReply", () => {

362357

mediaLocalRoots: ["/tmp/openclaw-media"],

363358

});

364359365-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

360+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

366361

expect.objectContaining({

367362

payloads: replies,

368363

replyToId: undefined,

@@ -426,7 +421,7 @@ describe("deliverDiscordReply", () => {

426421

threadBindings,

427422

});

428423429-

expect(deliverOutboundPayloadsMock).toHaveBeenCalledWith(

424+

expect(sendDurableMessageBatchMock).toHaveBeenCalledWith(

430425

expect.objectContaining({

431426

to: "channel:parent-1",

432427

threadId: "thread-1",