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

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
A
About on SuperTechFans
Vercel News
Vercel News
B
Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
腾讯CDC
D
Docker
V
Visual Studio Blog
博客园 - 叶小钗
The Cloudflare Blog
Jina AI
Jina AI
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏

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 ollama web search assertions · openclaw/ope...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -110,18 +110,30 @@ function expectOllamaWebSearchRequest(

110110

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

111111

}

112112113+

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

114+

if (!Array.isArray(results)) {

115+

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

116+

}

117+

expect(results).toHaveLength(1);

118+

const [result] = results;

119+

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

120+

throw new Error("Expected search result object");

121+

}

122+

expect((result as { url?: unknown }).url).toBe(url);

123+

}

124+113125

describe("ollama web search provider", () => {

114126

beforeEach(() => {

115127

fetchWithSsrFGuardMock.mockReset();

116128

});

117129118130

it("registers a keyless web search provider", () => {

119-

expect(createContractOllamaWebSearchProvider()).toMatchObject({

120-

id: "ollama",

121-

label: "Ollama Web Search",

122-

requiresCredential: false,

123-

envVars: [],

124-

});

131+

const provider = createContractOllamaWebSearchProvider();

132+133+

expect(provider.id).toBe("ollama");

134+

expect(provider.label).toBe("Ollama Web Search");

135+

expect(provider.requiresCredential).toBe(false);

136+

expect(provider.envVars).toEqual([]);

125137

});

126138127139

it("uses the configured Ollama host and enables the plugin in config", () => {

@@ -217,12 +229,10 @@ describe("ollama web search provider", () => {

217229

hostnameAllowlist: ["ollama.local"],

218230

},

219231

});

220-

expect(result).toMatchObject({

221-

query: "openclaw docs",

222-

provider: "ollama",

223-

count: 1,

224-

results: [{ url: "https://openclaw.ai/docs" }],

225-

});

232+

expect(result.query).toBe("openclaw docs");

233+

expect(result.provider).toBe("ollama");

234+

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

235+

expectSingleSearchResultUrl(result.results, "https://openclaw.ai/docs");

226236

expect(release).toHaveBeenCalledTimes(1);

227237

});

228238

@@ -245,13 +255,14 @@ describe("ollama web search provider", () => {

245255

release: vi.fn(async () => {}),

246256

});

247257248-

await expect(

249-

runOllamaWebSearch({ config: createOllamaConfig(), query: "openclaw" }),

250-

).resolves.toMatchObject({

251-

count: 1,

252-

results: [{ url: "https://example.com" }],

258+

const result = await runOllamaWebSearch({

259+

config: createOllamaConfig(),

260+

query: "openclaw",

253261

});

254262263+

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

264+

expectSingleSearchResultUrl(result.results, "https://example.com");

265+255266

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

256267

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

257268

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

@@ -272,16 +283,15 @@ describe("ollama web search provider", () => {

272283

release: vi.fn(async () => {}),

273284

});

274285275-

await expect(

276-

runOllamaWebSearch({

277-

config: createOllamaConfig({

278-

baseUrl: "https://ollama.com",

279-

apiKey: "cloud-config-secret",

280-

}),

281-

query: "openclaw",

286+

const result = await runOllamaWebSearch({

287+

config: createOllamaConfig({

288+

baseUrl: "https://ollama.com",

289+

apiKey: "cloud-config-secret",

282290

}),

283-

).resolves.toMatchObject({ count: 1 });

291+

query: "openclaw",

292+

});

284293294+

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

285295

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

286296

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

287297

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

@@ -323,12 +333,12 @@ describe("ollama web search provider", () => {

323333

release: vi.fn(async () => {}),

324334

});

325335326-

await expect(

327-

runOllamaWebSearch({ config: createOllamaConfig(), query: "openclaw" }),

328-

).resolves.toMatchObject({

329-

count: 1,

336+

const result = await runOllamaWebSearch({

337+

config: createOllamaConfig(),

338+

query: "openclaw",

330339

});

331340341+

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

332342

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

333343

| Record<string, string>

334344

| undefined;