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

推荐订阅源

宝玉的分享
宝玉的分享
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
Y
Y Combinator Blog
月光博客
月光博客
IT之家
IT之家
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
L
LangChain Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
博客园 - Franky
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
V
Visual Studio Blog
小众软件
小众软件
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium

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: guard ui chat avatar fetch calls · openclaw/opencla...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -105,6 +105,14 @@ function fetchInit(source: MockCallSource, callIndex: number) {

105105

return requireRecord(mockArg(source, callIndex, 1, `fetch init ${callIndex}`), "fetch init");

106106

}

107107108+

function fetchUrl(source: MockCallSource, callIndex: number) {

109+

const input = mockArg(source, callIndex, 0, `fetch input ${callIndex}`);

110+

if (typeof input === "string" || input instanceof URL || input instanceof Request) {

111+

return requestUrl(input);

112+

}

113+

throw new Error(`expected fetch input ${callIndex}`);

114+

}

115+108116

function makeHost(overrides?: Partial<ChatHost>): ChatHost {

109117

const host = {

110118

client: null,

@@ -303,14 +311,11 @@ describe("refreshChatAvatar", () => {

303311

const host = makeHost({ basePath: "", sessionKey: "agent:main" });

304312

await refreshChatAvatar(host);

305313306-

expect(fetchMock.mock.calls[0]?.[0]).toBe("/avatar/main?meta=1");

314+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 0)).toBe("/avatar/main?meta=1");

307315

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).method).toBe("GET");

308-

expect(fetchMock.mock.calls[1]?.[0]).toBe("/avatar/main");

316+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 1)).toBe("/avatar/main");

309317

expect(fetchInit(fetchMock as unknown as MockCallSource, 1).method).toBe("GET");

310-

const avatarFetchInit = (

311-

fetchMock.mock.calls as Array<[string | URL | Request, RequestInit?]>

312-

)[1]?.[1];

313-

expect(avatarFetchInit).not.toHaveProperty("headers");

318+

expect(fetchInit(fetchMock as unknown as MockCallSource, 1)).not.toHaveProperty("headers");

314319

expect(createObjectURL).toHaveBeenCalledTimes(1);

315320

expect(revokeObjectURL).not.toHaveBeenCalled();

316321

expect(host.chatAvatarUrl).toBe("blob:local-avatar");

@@ -353,12 +358,14 @@ describe("refreshChatAvatar", () => {

353358

});

354359

await refreshChatAvatar(host);

355360356-

expect(fetchMock.mock.calls[0]?.[0]).toBe("/openclaw/avatar/main?meta=1");

361+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 0)).toBe(

362+

"/openclaw/avatar/main?meta=1",

363+

);

357364

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).method).toBe("GET");

358365

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).headers).toEqual({

359366

Authorization: "Bearer device-token",

360367

});

361-

expect(fetchMock.mock.calls[1]?.[0]).toBe("/avatar/main");

368+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 1)).toBe("/avatar/main");

362369

expect(fetchInit(fetchMock as unknown as MockCallSource, 1).method).toBe("GET");

363370

expect(fetchInit(fetchMock as unknown as MockCallSource, 1).headers).toEqual({

364371

Authorization: "Bearer device-token",

@@ -403,12 +410,14 @@ describe("refreshChatAvatar", () => {

403410

});

404411

await refreshChatAvatar(host);

405412406-

expect(fetchMock.mock.calls[0]?.[0]).toBe("/openclaw/avatar/main?meta=1");

413+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 0)).toBe(

414+

"/openclaw/avatar/main?meta=1",

415+

);

407416

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).method).toBe("GET");

408417

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).headers).toEqual({

409418

Authorization: "Bearer session-token",

410419

});

411-

expect(fetchMock.mock.calls[1]?.[0]).toBe("/avatar/main");

420+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 1)).toBe("/avatar/main");

412421

expect(fetchInit(fetchMock as unknown as MockCallSource, 1).method).toBe("GET");

413422

expect(fetchInit(fetchMock as unknown as MockCallSource, 1).headers).toEqual({

414423

Authorization: "Bearer session-token",

@@ -428,7 +437,7 @@ describe("refreshChatAvatar", () => {

428437

const host = makeHost({ basePath: "/openclaw/", sessionKey: "agent:ops:main" });

429438

await refreshChatAvatar(host);

430439431-

expect(fetchMock.mock.calls[0]?.[0]).toBe("/openclaw/avatar/ops?meta=1");

440+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 0)).toBe("/openclaw/avatar/ops?meta=1");

432441

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).method).toBe("GET");

433442

expect(host.chatAvatarUrl).toBeNull();

434443

});

@@ -525,11 +534,11 @@ describe("refreshChatAvatar", () => {

525534526535

expect(createObjectURL).toHaveBeenCalledTimes(1);

527536

expect(host.chatAvatarUrl).toBe("blob:ops-avatar");

528-

expect(fetchMock.mock.calls[0]?.[0]).toBe("/avatar/main?meta=1");

537+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 0)).toBe("/avatar/main?meta=1");

529538

expect(fetchInit(fetchMock as unknown as MockCallSource, 0).method).toBe("GET");

530-

expect(fetchMock.mock.calls[1]?.[0]).toBe("/avatar/ops?meta=1");

539+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 1)).toBe("/avatar/ops?meta=1");

531540

expect(fetchInit(fetchMock as unknown as MockCallSource, 1).method).toBe("GET");

532-

expect(fetchMock.mock.calls[2]?.[0]).toBe("/avatar/ops");

541+

expect(fetchUrl(fetchMock as unknown as MockCallSource, 2)).toBe("/avatar/ops");

533542

expect(fetchInit(fetchMock as unknown as MockCallSource, 2).method).toBe("GET");

534543

});

535544

});