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

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
Jina AI
Jina AI
The Cloudflare Blog
V
Visual Studio Blog
博客园_首页
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
博客园 - Franky

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 openrouter image assertions · openclaw/open...
shakkernerd · 2026-05-09 · via Recent Commits to openclaw:main

@@ -31,6 +31,31 @@ vi.mock("openclaw/plugin-sdk/provider-http", () => ({

3131

resolveProviderHttpRequestConfig: resolveProviderHttpRequestConfigMock,

3232

}));

333334+

function requireOpenRouterPostBody(): {

35+

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

36+

} {

37+

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

38+

expect(request).toBeDefined();

39+

if (!request) {

40+

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

41+

}

42+

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

43+

}

44+45+

function requireGeneratedImage(

46+

result: Awaited<

47+

ReturnType<ReturnType<typeof buildOpenRouterImageGenerationProvider>["generateImage"]>

48+

>,

49+

index: number,

50+

) {

51+

const image = result.images[index];

52+

expect(image).toBeDefined();

53+

if (!image) {

54+

throw new Error(`expected OpenRouter generated image at index ${index}`);

55+

}

56+

return image;

57+

}

58+3459

describe("openrouter image generation provider", () => {

3560

afterEach(() => {

3661

assertOkOrThrowHttpErrorMock.mockClear();

@@ -125,8 +150,9 @@ describe("openrouter image generation provider", () => {

125150

}),

126151

}),

127152

);

128-

expect(result.images[0]?.buffer.toString()).toBe("png-one");

129-

expect(result.images[0]?.mimeType).toBe("image/png");

153+

const image = requireGeneratedImage(result, 0);

154+

expect(image.buffer.toString()).toBe("png-one");

155+

expect(image.mimeType).toBe("image/png");

130156

expect(release).toHaveBeenCalledOnce();

131157

});

132158

@@ -162,9 +188,7 @@ describe("openrouter image generation provider", () => {

162188

cfg: {} as never,

163189

});

164190165-

const body = postJsonRequestMock.mock.calls[0]?.[0].body as {

166-

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

167-

};

191+

const body = requireOpenRouterPostBody();

168192

expect(body.messages?.[0]?.content).toEqual([

169193

{ type: "text", text: "turn this into watercolor" },

170194

{

@@ -174,8 +198,9 @@ describe("openrouter image generation provider", () => {

174198

},

175199

},

176200

]);

177-

expect(result.images[0]?.buffer.toString()).toBe("webp-one");

178-

expect(result.images[0]?.mimeType).toBe("image/webp");

201+

const image = requireGeneratedImage(result, 0);

202+

expect(image.buffer.toString()).toBe("webp-one");

203+

expect(image.mimeType).toBe("image/webp");

179204

});

180205181206

it("extracts image fallbacks from string content and raw b64 parts", () => {