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

推荐订阅源

S
SegmentFault 最新的问题
Jina AI
Jina AI
罗磊的独立博客
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
J
Java Code Geeks
U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
InfoQ
月光博客
月光博客
博客园_首页
Vercel News
Vercel News
P
Proofpoint News Feed
GbyAI
GbyAI
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 media fetch assertions · openclaw/openclaw@...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -90,20 +90,27 @@ async function expectFetchRemoteMediaRejected(params: {

9090

lookupFn?: LookupFn;

9191

expectedError: RegExp | string | Record<string, unknown>;

9292

}) {

93-

const rejection = expect(

94-

fetchRemoteMedia({

95-

url: params.url,

96-

fetchImpl: params.fetchImpl,

97-

lookupFn: params.lookupFn ?? makeLookupFn(),

98-

maxBytes: params.maxBytes ?? 1024,

99-

...(params.readIdleTimeoutMs ? { readIdleTimeoutMs: params.readIdleTimeoutMs } : {}),

100-

}),

101-

).rejects;

93+

const request = {

94+

url: params.url,

95+

fetchImpl: params.fetchImpl,

96+

lookupFn: params.lookupFn ?? makeLookupFn(),

97+

maxBytes: params.maxBytes ?? 1024,

98+

...(params.readIdleTimeoutMs ? { readIdleTimeoutMs: params.readIdleTimeoutMs } : {}),

99+

};

102100

if (params.expectedError instanceof RegExp || typeof params.expectedError === "string") {

103-

await rejection.toThrow(params.expectedError);

101+

await expect(fetchRemoteMedia(request)).rejects.toThrow(params.expectedError);

104102

return;

105103

}

106-

await rejection.toMatchObject(params.expectedError);

104+

let fetchError: unknown;

105+

try {

106+

await fetchRemoteMedia(request);

107+

} catch (error) {

108+

fetchError = error;

109+

}

110+

expect(fetchError).toBeInstanceOf(Error);

111+

for (const [key, value] of Object.entries(params.expectedError)) {

112+

expect((fetchError as Record<string, unknown>)[key]).toStrictEqual(value);

113+

}

107114

}

108115109116

async function expectFetchRemoteMediaResolvesToError(

@@ -315,31 +322,35 @@ describe("fetchRemoteMedia", () => {

315322316323

it("uses trusted explicit-proxy mode when the caller opts in for proxy-side DNS", async () => {

317324

const fetchImpl = vi.fn(async () => new Response("ok", { status: 200 }));

325+

const lookupFn = makeLookupFn();

326+

const dispatcherPolicy = {

327+

mode: "explicit-proxy" as const,

328+

proxyUrl: "http://localhost:8888",

329+

allowPrivateProxy: true,

330+

};

318331319332

await fetchRemoteMedia({

320333

url: "https://files.example.test/file/bot123/photos/test.jpg",

321334

fetchImpl,

322-

lookupFn: makeLookupFn(),

335+

lookupFn,

323336

trustExplicitProxyDns: true,

324337

dispatcherAttempts: [

325338

{

326-

dispatcherPolicy: {

327-

mode: "explicit-proxy",

328-

proxyUrl: "http://localhost:8888",

329-

allowPrivateProxy: true,

330-

},

339+

dispatcherPolicy,

331340

},

332341

],

333342

});

334343335-

expect(fetchWithSsrFGuardMock).toHaveBeenCalledWith(

336-

expect.objectContaining({

337-

mode: "trusted_explicit_proxy",

338-

dispatcherPolicy: expect.objectContaining({

339-

mode: "explicit-proxy",

340-

proxyUrl: "http://localhost:8888",

341-

}),

342-

}),

343-

);

344+

expect(fetchWithSsrFGuardMock).toHaveBeenCalledTimes(1);

345+

expect(fetchWithSsrFGuardMock.mock.calls[0]?.[0]).toStrictEqual({

346+

url: "https://files.example.test/file/bot123/photos/test.jpg",

347+

fetchImpl,

348+

init: undefined,

349+

maxRedirects: undefined,

350+

policy: undefined,

351+

lookupFn,

352+

dispatcherPolicy,

353+

mode: "trusted_explicit_proxy",

354+

});

344355

});

345356

});