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

推荐订阅源

罗磊的独立博客
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
C
Check Point Blog
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
GbyAI
GbyAI
云风的 BLOG
云风的 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: guard provider request mock calls · openclaw/opencl...
steipete · 2026-05-12 · via Recent Commits to openclaw:main

@@ -36,11 +36,39 @@ vi.mock("openclaw/plugin-sdk/provider-http", () => ({

3636

function requireOpenRouterPostBody(): {

3737

messages?: Array<{ content?: unknown }>;

3838

} {

39-

const request = postJsonRequestMock.mock.calls[0]?.[0];

40-

if (!request) {

39+

const request = requireOpenRouterPostRequest();

40+

return request.body as { messages?: Array<{ content?: unknown }> };

41+

}

42+43+

function requireOpenRouterPostRequest(): Record<string, unknown> {

44+

const [call] = postJsonRequestMock.mock.calls;

45+

if (!call) {

4146

throw new Error("expected OpenRouter image generation request");

4247

}

43-

return request.body as { messages?: Array<{ content?: unknown }> };

48+

const [request] = call;

49+

if (!request || typeof request !== "object" || Array.isArray(request)) {

50+

throw new Error("expected OpenRouter image generation request");

51+

}

52+

return request as Record<string, unknown>;

53+

}

54+55+

function requireOpenRouterConfigRequest(): Record<string, unknown> {

56+

const [call] = resolveProviderHttpRequestConfigMock.mock.calls;

57+

if (!call) {

58+

throw new Error("expected OpenRouter image config request");

59+

}

60+

const [request] = call;

61+

if (!request || typeof request !== "object" || Array.isArray(request)) {

62+

throw new Error("expected OpenRouter image config request");

63+

}

64+

return request;

65+

}

66+67+

function requireHeaders(value: unknown): Headers {

68+

if (!(value instanceof Headers)) {

69+

throw new Error("expected OpenRouter image request headers");

70+

}

71+

return value;

4472

}

45734674

function requireGeneratedImage(

@@ -129,6 +157,7 @@ describe("openrouter image generation provider", () => {

129157

providers: {

130158

openrouter: {

131159

baseUrl: "https://custom.openrouter.test/api/v1",

160+

models: [],

132161

},

133162

},

134163

},

@@ -137,7 +166,7 @@ describe("openrouter image generation provider", () => {

137166

store: undefined,

138167

});

139168

expect(resolveProviderHttpRequestConfigMock).toHaveBeenCalledOnce();

140-

expect(resolveProviderHttpRequestConfigMock.mock.calls[0]?.[0]).toEqual({

169+

expect(requireOpenRouterConfigRequest()).toEqual({

141170

baseUrl: "https://custom.openrouter.test/api/v1",

142171

defaultBaseUrl: "https://openrouter.ai/api/v1",

143172

allowPrivateNetwork: false,

@@ -151,19 +180,16 @@ describe("openrouter image generation provider", () => {

151180

transport: "http",

152181

});

153182

expect(postJsonRequestMock).toHaveBeenCalledOnce();

154-

const request = postJsonRequestMock.mock.calls[0]?.[0];

155-

if (!request) {

156-

throw new Error("expected OpenRouter image generation request");

157-

}

158-

expect(request.headers).toBeInstanceOf(Headers);

159-

expect(Object.fromEntries(request.headers.entries())).toEqual({

183+

const request = requireOpenRouterPostRequest();

184+

const headers = requireHeaders(request.headers);

185+

expect(Object.fromEntries(headers.entries())).toEqual({

160186

authorization: "Bearer openrouter-key",

161187

"http-referer": "https://openclaw.ai",

162188

"x-openrouter-title": "OpenClaw",

163189

});

164190

expect(request).toEqual({

165191

url: "https://custom.openrouter.test/api/v1/chat/completions",

166-

headers: request.headers,

192+

headers,

167193

body: {

168194

model: "google/gemini-3.1-flash-image-preview",

169195

messages: [