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

推荐订阅源

人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
量子位
GbyAI
GbyAI
腾讯CDC
T
Tailwind CSS Blog
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
Docker
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
Jina AI
Jina AI
IT之家
IT之家
Y
Y Combinator 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: tighten outbound payload contract assertions · open...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -31,6 +31,14 @@ export type OutboundPayloadHarnessParams = {

3131

sendResults?: SendResultLike[];

3232

};

333334+

function sendCall(sendMock: Mock, index: number): unknown[] {

35+

const call = sendMock.mock.calls[index];

36+

if (!call) {

37+

throw new Error(`expected send call ${index}`);

38+

}

39+

return call;

40+

}

41+3442

export function installChannelOutboundPayloadContractSuite(params: {

3543

channel: string;

3644

chunking: ChunkingMode;

@@ -49,8 +57,11 @@ export function installChannelOutboundPayloadContractSuite(params: {

4957

const result = await run();

50585159

expect(sendMock).toHaveBeenCalledTimes(1);

52-

expect(sendMock).toHaveBeenCalledWith(to, "hello", expect.any(Object));

53-

expect(result).toMatchObject({ channel: params.channel });

60+

const call = sendCall(sendMock, 0);

61+

expect(call[0]).toBe(to);

62+

expect(call[1]).toBe("hello");

63+

expect(call[2]).toBeDefined();

64+

expect(result.channel).toBe(params.channel);

5465

});

55665667

it("single media delegates to sendMedia", async () => {

@@ -60,12 +71,11 @@ export function installChannelOutboundPayloadContractSuite(params: {

6071

const result = await run();

61726273

expect(sendMock).toHaveBeenCalledTimes(1);

63-

expect(sendMock).toHaveBeenCalledWith(

64-

to,

65-

"cap",

66-

expect.objectContaining({ mediaUrl: "https://example.com/a.jpg" }),

67-

);

68-

expect(result).toMatchObject({ channel: params.channel });

74+

const call = sendCall(sendMock, 0);

75+

expect(call[0]).toBe(to);

76+

expect(call[1]).toBe("cap");

77+

expect((call[2] as Record<string, unknown>).mediaUrl).toBe("https://example.com/a.jpg");

78+

expect(result.channel).toBe(params.channel);

6979

});

70807181

it("multi-media iterates URLs with caption on first", async () => {

@@ -79,19 +89,16 @@ export function installChannelOutboundPayloadContractSuite(params: {

7989

const result = await run();

80908191

expect(sendMock).toHaveBeenCalledTimes(2);

82-

expect(sendMock).toHaveBeenNthCalledWith(

83-

1,

84-

to,

85-

"caption",

86-

expect.objectContaining({ mediaUrl: "https://example.com/1.jpg" }),

87-

);

88-

expect(sendMock).toHaveBeenNthCalledWith(

89-

2,

90-

to,

91-

"",

92-

expect.objectContaining({ mediaUrl: "https://example.com/2.jpg" }),

93-

);

94-

expect(result).toMatchObject({ channel: params.channel, messageId: "m-2" });

92+

const first = sendCall(sendMock, 0);

93+

expect(first[0]).toBe(to);

94+

expect(first[1]).toBe("caption");

95+

expect((first[2] as Record<string, unknown>).mediaUrl).toBe("https://example.com/1.jpg");

96+

const second = sendCall(sendMock, 1);

97+

expect(second[0]).toBe(to);

98+

expect(second[1]).toBe("");

99+

expect((second[2] as Record<string, unknown>).mediaUrl).toBe("https://example.com/2.jpg");

100+

expect(result.channel).toBe(params.channel);

101+

expect(result.messageId).toBe("m-2");

95102

});

9610397104

it("empty payload returns no-op", async () => {

@@ -109,8 +116,11 @@ export function installChannelOutboundPayloadContractSuite(params: {

109116

const result = await run();

110117111118

expect(sendMock).toHaveBeenCalledTimes(1);

112-

expect(sendMock).toHaveBeenCalledWith(to, text, expect.any(Object));

113-

expect(result).toMatchObject({ channel: params.channel });

119+

const call = sendCall(sendMock, 0);

120+

expect(call[0]).toBe(to);

121+

expect(call[1]).toBe(text);

122+

expect(call[2]).toBeDefined();

123+

expect(result.channel).toBe(params.channel);

114124

});

115125

return;

116126

}

@@ -129,6 +139,6 @@ export function installChannelOutboundPayloadContractSuite(params: {

129139

for (const call of sendMock.mock.calls) {

130140

expect((call[1] as string).length).toBeLessThanOrEqual(chunking.maxChunkLength);

131141

}

132-

expect(result).toMatchObject({ channel: params.channel });

142+

expect(result.channel).toBe(params.channel);

133143

});

134144

}