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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
GbyAI
GbyAI
M
MIT News - Artificial intelligence
美团技术团队
罗磊的独立博客
雷峰网
雷峰网
量子位
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
D
Docker
小众软件
小众软件
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
WordPress大学
WordPress大学
V
V2EX
博客园_首页
腾讯CDC
The Cloudflare Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

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 tui command assertions · openclaw/openclaw@...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -18,6 +18,24 @@ async function flushAsyncSelect() {

1818

await new Promise<void>((resolve) => setImmediate(resolve));

1919

}

202021+

function expectSendChatFields(

22+

sendChat: ReturnType<typeof vi.fn>,

23+

expected: { message: string; sessionId?: string; sessionKey?: string },

24+

) {

25+

const call = sendChat.mock.calls.at(-1);

26+

if (!call) {

27+

throw new Error("expected gateway sendChat call");

28+

}

29+

const payload = call[0] as { message?: unknown; sessionId?: unknown; sessionKey?: unknown };

30+

expect(payload.message).toBe(expected.message);

31+

if (expected.sessionId !== undefined) {

32+

expect(payload.sessionId).toBe(expected.sessionId);

33+

}

34+

if (expected.sessionKey !== undefined) {

35+

expect(payload.sessionKey).toBe(expected.sessionKey);

36+

}

37+

}

38+2139

function createHarness(params?: {

2240

sendChat?: ReturnType<typeof vi.fn>;

2341

getGatewayStatus?: ReturnType<typeof vi.fn>;

@@ -193,12 +211,10 @@ describe("tui command handlers", () => {

193211194212

expect(addSystem).not.toHaveBeenCalled();

195213

expect(addUser).toHaveBeenCalledWith("/unregistered-command");

196-

expect(sendChat).toHaveBeenCalledWith(

197-

expect.objectContaining({

198-

sessionKey: "agent:main:main",

199-

message: "/unregistered-command",

200-

}),

201-

);

214+

expectSendChatFields(sendChat, {

215+

sessionKey: "agent:main:main",

216+

message: "/unregistered-command",

217+

});

202218

expect(requestRender).toHaveBeenCalled();

203219

});

204220

@@ -209,13 +225,11 @@ describe("tui command handlers", () => {

209225210226

await handleCommand("/status");

211227212-

expect(sendChat).toHaveBeenCalledWith(

213-

expect.objectContaining({

214-

sessionKey: "agent:main:main",

215-

sessionId: "session-before-relaunch",

216-

message: "/status",

217-

}),

218-

);

228+

expectSendChatFields(sendChat, {

229+

sessionKey: "agent:main:main",

230+

sessionId: "session-before-relaunch",

231+

message: "/status",

232+

});

219233

});

220234221235

it("opens a context mode selector for /context without sending immediately", async () => {

@@ -235,12 +249,10 @@ describe("tui command handlers", () => {

235249

selector?.onSelect?.({ value: "detail", label: "detail" });

236250

await flushAsyncSelect();

237251238-

expect(sendChat).toHaveBeenCalledWith(

239-

expect.objectContaining({

240-

sessionKey: "agent:main:main",

241-

message: "/context detail",

242-

}),

243-

);

252+

expectSendChatFields(sendChat, {

253+

sessionKey: "agent:main:main",

254+

message: "/context detail",

255+

});

244256

expect(closeOverlay).toHaveBeenCalledTimes(1);

245257

});

246258

@@ -250,12 +262,10 @@ describe("tui command handlers", () => {

250262

await handleCommand("/context list");

251263252264

expect(openOverlay).not.toHaveBeenCalled();

253-

expect(sendChat).toHaveBeenCalledWith(

254-

expect.objectContaining({

255-

sessionKey: "agent:main:main",

256-

message: "/context list",

257-

}),

258-

);

265+

expectSendChatFields(sendChat, {

266+

sessionKey: "agent:main:main",

267+

message: "/context list",

268+

});

259269

});

260270261271

it("forwards /context help directly", async () => {

@@ -264,12 +274,10 @@ describe("tui command handlers", () => {

264274

await handleCommand("/context help");

265275266276

expect(openOverlay).not.toHaveBeenCalled();

267-

expect(sendChat).toHaveBeenCalledWith(

268-

expect.objectContaining({

269-

sessionKey: "agent:main:main",

270-

message: "/context help",

271-

}),

272-

);

277+

expectSendChatFields(sendChat, {

278+

sessionKey: "agent:main:main",

279+

message: "/context help",

280+

});

273281

});

274282275283

it("forwards /status to the shared gateway command path", async () => {

@@ -279,12 +287,10 @@ describe("tui command handlers", () => {

279287280288

expect(addSystem).not.toHaveBeenCalled();

281289

expect(addUser).toHaveBeenCalledWith("/status");

282-

expect(sendChat).toHaveBeenCalledWith(

283-

expect.objectContaining({

284-

sessionKey: "agent:main:main",

285-

message: "/status",

286-

}),

287-

);

290+

expectSendChatFields(sendChat, {

291+

sessionKey: "agent:main:main",

292+

message: "/status",

293+

});

288294

});

289295290296

it("keeps gateway diagnostics on /gateway-status", async () => {

@@ -376,11 +382,7 @@ describe("tui command handlers", () => {

376382

expect(state.activeChatRunId).toBe("run-main");

377383

expect(setActivityStatus).not.toHaveBeenCalledWith("sending");

378384

expect(setActivityStatus).not.toHaveBeenCalledWith("waiting");

379-

expect(sendChat).toHaveBeenCalledWith(

380-

expect.objectContaining({

381-

message: "/btw what changed?",

382-

}),

383-

);

385+

expectSendChatFields(sendChat, { message: "/btw what changed?" });

384386

});

385387386388

it("sends /side without hijacking the active main run", async () => {

@@ -395,11 +397,7 @@ describe("tui command handlers", () => {

395397

expect(noteLocalRunId).not.toHaveBeenCalled();

396398

expect(noteLocalBtwRunId).toHaveBeenCalledTimes(1);

397399

expect(state.activeChatRunId).toBe("run-main");

398-

expect(sendChat).toHaveBeenCalledWith(

399-

expect.objectContaining({

400-

message: "/side what changed?",

401-

}),

402-

);

400+

expectSendChatFields(sendChat, { message: "/side what changed?" });

403401

});

404402405403

it("creates unique session for /new and resets shared session for /reset", async () => {

@@ -559,10 +557,8 @@ describe("tui command handlers", () => {

559557

await handleCommand("/model");

560558561559

const selector = openOverlay.mock.calls[0]?.[0] as SelectableOverlay | undefined;

562-

expect(selector?.items?.[0]).toMatchObject({

563-

value: "openrouter/auto",

564-

label: "openrouter/auto",

565-

});

560+

expect(selector?.items?.[0]?.value).toBe("openrouter/auto");

561+

expect(selector?.items?.[0]?.label).toBe("openrouter/auto");

566562567563

selector?.onSelect?.({ value: "openrouter/auto", label: "openrouter/auto" });

568564

await flushAsyncSelect();