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

推荐订阅源

博客园 - Franky
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 司徒正美
D
Docker
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
J
Java Code Geeks
Jina AI
Jina AI
博客园 - 【当耐特】
C
Check Point Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio 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: clear cli message helper broad matchers · openclaw/...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -93,6 +93,28 @@ function expectNoAccountFieldInPassedOptions() {

9393

expect(passedOpts).not.toHaveProperty("account");

9494

}

959596+

function requireRecord(value: unknown, label: string): Record<string, unknown> {

97+

if (typeof value !== "object" || value === null || Array.isArray(value)) {

98+

throw new Error(`expected ${label} to be an object`);

99+

}

100+

return value as Record<string, unknown>;

101+

}

102+103+

function expectMessageCommandOptions(expected: Record<string, unknown>, callIndex = 0): void {

104+

const call = (messageCommandMock.mock.calls as unknown[][])[callIndex];

105+

if (!call) {

106+

throw new Error(`expected messageCommand call ${callIndex}`);

107+

}

108+

const options = requireRecord(call[0], `messageCommand options ${callIndex}`);

109+

for (const [key, expectedValue] of Object.entries(expected)) {

110+

expect(options[key], `messageCommand options.${key}`).toEqual(expectedValue);

111+

}

112+

expect(call[1], "messageCommand runtime").not.toBeNull();

113+

expect(call[1], "messageCommand runtime").not.toBeUndefined();

114+

expect(call[2], "messageCommand deps").not.toBeNull();

115+

expect(call[2], "messageCommand deps").not.toBeUndefined();

116+

}

117+96118

describe("runMessageAction", () => {

97119

beforeEach(() => {

98120

vi.clearAllMocks();

@@ -141,16 +163,12 @@ describe("runMessageAction", () => {

141163

await runSendAction({ target: "channel:12345" });

142164143165

expect(ensurePluginRegistryLoaded).not.toHaveBeenCalled();

144-

expect(messageCommandMock).toHaveBeenCalledWith(

145-

expect.objectContaining({

146-

action: "send",

147-

channel: "discord",

148-

target: "channel:12345",

149-

message: "hi",

150-

}),

151-

expect.anything(),

152-

expect.anything(),

153-

);

166+

expectMessageCommandOptions({

167+

action: "send",

168+

channel: "discord",

169+

target: "channel:12345",

170+

message: "hi",

171+

});

154172

expect(exitMock).toHaveBeenCalledWith(0);

155173

});

156174

@@ -168,15 +186,11 @@ describe("runMessageAction", () => {

168186

scope: "configured-channels",

169187

onlyChannelIds: ["telegram"],

170188

});

171-

expect(messageCommandMock).toHaveBeenCalledWith(

172-

expect.objectContaining({

173-

action: "broadcast",

174-

targets: ["telegram:1", "telegram:2"],

175-

message: "hi",

176-

}),

177-

expect.anything(),

178-

expect.anything(),

179-

);

189+

expectMessageCommandOptions({

190+

action: "broadcast",

191+

targets: ["telegram:1", "telegram:2"],

192+

message: "hi",

193+

});

180194

});

181195182196

it("keeps unknown actions on the local preload path", async () => {

@@ -194,13 +208,7 @@ describe("runMessageAction", () => {

194208

scope: "configured-channels",

195209

onlyChannelIds: ["discord"],

196210

});

197-

expect(messageCommandMock).toHaveBeenCalledWith(

198-

expect.objectContaining({

199-

action: "custom-action",

200-

}),

201-

expect.anything(),

202-

expect.anything(),

203-

);

211+

expectMessageCommandOptions({ action: "custom-action" });

204212

});

205213206214

it("preloads when the scoped channel plugin is not cheaply available", async () => {

@@ -218,15 +226,11 @@ describe("runMessageAction", () => {

218226

await runSendAction({ channel: undefined, target: "telegram:12345" });

219227220228

expect(ensurePluginRegistryLoaded).not.toHaveBeenCalled();

221-

expect(messageCommandMock).toHaveBeenCalledWith(

222-

expect.objectContaining({

223-

action: "send",

224-

target: "telegram:12345",

225-

message: "hi",

226-

}),

227-

expect.anything(),

228-

expect.anything(),

229-

);

229+

expectMessageCommandOptions({

230+

action: "send",

231+

target: "telegram:12345",

232+

message: "hi",

233+

});

230234

expect(exitMock).toHaveBeenCalledWith(0);

231235

});

232236

@@ -242,21 +246,17 @@ describe("runMessageAction", () => {

242246

});

243247244248

expect(ensurePluginRegistryLoaded).not.toHaveBeenCalled();

245-

expect(messageCommandMock).toHaveBeenCalledWith(

246-

expect.objectContaining({

247-

action: "send",

248-

channel: "telegram",

249-

accountId: "default",

250-

target: "@ops",

251-

message: "hi",

252-

media: "./diagram.png",

253-

presentation: '{"blocks":[{"type":"buttons","buttons":[{"label":"OK","value":"ok"}]}]}',

254-

delivery: '{"pin":true}',

255-

forceDocument: true,

256-

}),

257-

expect.anything(),

258-

expect.anything(),

259-

);

249+

expectMessageCommandOptions({

250+

action: "send",

251+

channel: "telegram",

252+

accountId: "default",

253+

target: "@ops",

254+

message: "hi",

255+

media: "./diagram.png",

256+

presentation: '{"blocks":[{"type":"buttons","buttons":[{"label":"OK","value":"ok"}]}]}',

257+

delivery: '{"pin":true}',

258+

forceDocument: true,

259+

});

260260

expectNoAccountFieldInPassedOptions();

261261

expect(exitMock).toHaveBeenCalledWith(0);

262262

});

@@ -419,17 +419,13 @@ describe("runMessageAction", () => {

419419

}),

420420

).rejects.toThrow("exit");

421421422-

expect(messageCommandMock).toHaveBeenCalledWith(

423-

expect.objectContaining({

424-

action: "poll",

425-

channel: "discord",

426-

target: "456",

427-

accountId: "acct-1",

428-

message: "hi",

429-

}),

430-

expect.anything(),

431-

expect.anything(),

432-

);

422+

expectMessageCommandOptions({

423+

action: "poll",

424+

channel: "discord",

425+

target: "456",

426+

accountId: "acct-1",

427+

message: "hi",

428+

});

433429

// account key should be stripped in favor of accountId

434430

expectNoAccountFieldInPassedOptions();

435431

});

@@ -446,16 +442,12 @@ describe("runMessageAction", () => {

446442

}),

447443

).rejects.toThrow("exit");

448444449-

expect(messageCommandMock).toHaveBeenCalledWith(

450-

expect.objectContaining({

451-

action: "send",

452-

channel: "discord",

453-

target: "789",

454-

accountId: undefined,

455-

}),

456-

expect.anything(),

457-

expect.anything(),

458-

);

445+

expectMessageCommandOptions({

446+

action: "send",

447+

channel: "discord",

448+

target: "789",

449+

accountId: undefined,

450+

});

459451

expectNoAccountFieldInPassedOptions();

460452

});

461453

});