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

推荐订阅源

B
Blog
D
Docker
J
Java Code Geeks
腾讯CDC
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
M
MIT News - Artificial intelligence
L
LangChain Blog
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
博客园 - Franky
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
N
Netflix TechBlog - Medium
B
Blog RSS Feed
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News

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 setup mock calls · openclaw/openclaw@...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -70,6 +70,14 @@ function createOllamaFetchMock(params: {

7070

});

7171

}

727273+

function mockCall(mock: { mock: { calls: unknown[][] } }, index = 0) {

74+

return mock.mock.calls.at(index);

75+

}

76+77+

function mockCallArg(mock: { mock: { calls: unknown[][] } }, index = 0, argIndex = 0) {

78+

return mockCall(mock, index)?.at(argIndex);

79+

}

80+7381

function createLocalPrompter(): WizardPrompter {

7482

return {

7583

select: vi.fn().mockResolvedValueOnce("local-only"),

@@ -151,7 +159,7 @@ describe("ollama setup", () => {

151159

prompter,

152160

});

153161154-

const baseUrlPrompt = text.mock.calls[0]?.[0] as {

162+

const baseUrlPrompt = mockCallArg(text) as {

155163

message?: string;

156164

initialValue?: string;

157165

placeholder?: string;

@@ -164,7 +172,7 @@ describe("ollama setup", () => {

164172

validate: baseUrlPrompt.validate,

165173

});

166174

expect(typeof baseUrlPrompt.validate).toBe("function");

167-

expect(fetchMock.mock.calls[0]?.[0]).toBe("http://host.docker.internal:11434/api/tags");

175+

expect(mockCallArg(fetchMock)).toBe("http://host.docker.internal:11434/api/tags");

168176

expect(result.config.models?.providers?.ollama?.baseUrl).toBe(

169177

"http://host.docker.internal:11434",

170178

);

@@ -485,8 +493,8 @@ describe("ollama setup", () => {

485493

});

486494487495

expect(fetchMock).toHaveBeenCalledTimes(2);

488-

expect(fetchMock.mock.calls[1][0]).toContain("/api/pull");

489-

const pullInit = fetchMock.mock.calls[1][1];

496+

expect(mockCallArg(fetchMock, 1)).toContain("/api/pull");

497+

const pullInit = mockCallArg(fetchMock, 1, 1) as RequestInit | undefined;

490498

expect(pullInit?.signal).toBeInstanceOf(AbortSignal);

491499

expect(pullInit?.signal?.aborted).toBe(false);

492500

@@ -522,7 +530,7 @@ describe("ollama setup", () => {

522530

prompter,

523531

}).catch((err: unknown) => err);

524532525-

await vi.waitFor(() => expect(fetchMock.mock.calls[1]?.[0]).toContain("/api/pull"));

533+

await vi.waitFor(() => expect(mockCallArg(fetchMock, 1)).toContain("/api/pull"));

526534527535

await vi.advanceTimersByTimeAsync(300_000);

528536

const pullError = await pullPromise;

@@ -595,8 +603,8 @@ describe("ollama setup", () => {

595603

prompter,

596604

});

597605598-

expect(fetchMock.mock.calls[0]?.[0]).toBe("http://127.0.0.1:11435/api/tags");

599-

expect(fetchMock.mock.calls[1]?.[0]).toBe("http://127.0.0.1:11435/api/pull");

606+

expect(mockCallArg(fetchMock)).toBe("http://127.0.0.1:11435/api/tags");

607+

expect(mockCallArg(fetchMock, 1)).toBe("http://127.0.0.1:11435/api/pull");

600608

});

601609602610

it("skips pull for cloud models", async () => {

@@ -680,7 +688,7 @@ describe("ollama setup", () => {

680688

runtime,

681689

});

682690683-

const pullRequest = fetchMock.mock.calls[1]?.[1];

691+

const pullRequest = mockCallArg(fetchMock, 1, 1) as RequestInit | undefined;

684692

expect(JSON.parse(requestBodyText(pullRequest?.body))).toEqual({ name: "llama3.2:latest" });

685693

expect(result.agents?.defaults?.model).toEqual({ primary: "ollama/llama3.2:latest" });

686694

});