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

推荐订阅源

D
DataBreaches.Net
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
博客园 - 聂微东
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog RSS Feed
小众软件
小众软件
The GitHub Blog
The GitHub Blog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
B
Blog
H
Help Net Security
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
月光博客
月光博客
博客园 - 司徒正美

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: dedupe ollama web search mock calls · openclaw/open...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -110,6 +110,28 @@ function expectOllamaWebSearchRequest(

110110

expect(request.init.signal).toBeInstanceOf(AbortSignal);

111111

}

112112113+

function fetchCall(index = 0): unknown[] {

114+

const call = fetchWithSsrFGuardMock.mock.calls.at(index);

115+

if (!call) {

116+

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

117+

}

118+

return call;

119+

}

120+121+

function fetchRequest(index = 0): {

122+

init?: { headers?: Record<string, string> };

123+

url?: string;

124+

} {

125+

const request = fetchCall(index).at(0);

126+

if (!request || typeof request !== "object") {

127+

throw new Error(`expected guarded fetch request ${index}`);

128+

}

129+

return request as {

130+

init?: { headers?: Record<string, string> };

131+

url?: string;

132+

};

133+

}

134+113135

function expectSingleSearchResultUrl(results: unknown, url: string) {

114136

if (!Array.isArray(results)) {

115137

throw new Error("Expected search results array");

@@ -220,7 +242,7 @@ describe("ollama web search provider", () => {

220242

}

221243

const result = await tool.execute({ query: "openclaw docs", count: 3 });

222244223-

expectOllamaWebSearchRequest(fetchWithSsrFGuardMock.mock.calls[0], {

245+

expectOllamaWebSearchRequest(fetchCall(), {

224246

url: "http://ollama.local:11434/api/experimental/web_search",

225247

query: "openclaw docs",

226248

maxResults: 3,

@@ -293,8 +315,8 @@ describe("ollama web search provider", () => {

293315294316

expect(result.count).toBe(1);

295317

expect(fetchWithSsrFGuardMock.mock.calls).toHaveLength(1);

296-

expect(fetchWithSsrFGuardMock.mock.calls[0]?.[0].url).toBe("https://ollama.com/api/web_search");

297-

expectOllamaWebSearchRequest(fetchWithSsrFGuardMock.mock.calls[0], {

318+

expect(fetchRequest().url).toBe("https://ollama.com/api/web_search");

319+

expectOllamaWebSearchRequest(fetchCall(), {

298320

url: "https://ollama.com/api/web_search",

299321

headers: {

300322

"Content-Type": "application/json",

@@ -339,22 +361,16 @@ describe("ollama web search provider", () => {

339361

});

340362341363

expect(result.count).toBe(1);

342-

const firstHeaders = fetchWithSsrFGuardMock.mock.calls[0]?.[0].init?.headers as

343-

| Record<string, string>

344-

| undefined;

345-

const cloudHeaders = fetchWithSsrFGuardMock.mock.calls[2]?.[0].init?.headers as

346-

| Record<string, string>

347-

| undefined;

364+

const firstHeaders = fetchRequest().init?.headers;

365+

const cloudHeaders = fetchRequest(2).init?.headers;

348366

expect(firstHeaders?.Authorization).toBeUndefined();

349367

expect(cloudHeaders?.Authorization).toBe("Bearer cloud-secret");

350368

expect(fetchWithSsrFGuardMock.mock.calls.map((call) => call[0].url)).toEqual([

351369

"http://ollama.local:11434/api/experimental/web_search",

352370

"http://ollama.local:11434/api/web_search",

353371

"https://ollama.com/api/web_search",

354372

]);

355-

expect(fetchWithSsrFGuardMock.mock.calls[2]?.[0].url).toBe(

356-

"https://ollama.com/api/web_search",

357-

);

373+

expect(fetchRequest(2).url).toBe("https://ollama.com/api/web_search");

358374

} finally {

359375

if (original === undefined) {

360376

delete process.env.OLLAMA_API_KEY;