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

推荐订阅源

Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
博客园_首页
量子位
雷峰网
雷峰网
GbyAI
GbyAI
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Cloudflare Blog
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东

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

@@ -61,6 +61,41 @@ function releasedVideo(params: { contentType: string; bytes: string }) {

6161

};

6262

}

636364+

type OpenRouterVideoProvider = ReturnType<typeof buildOpenRouterVideoGenerationProvider>;

65+

type OpenRouterVideoResult = Awaited<ReturnType<OpenRouterVideoProvider["generateVideo"]>>;

66+67+

function requireGenerateCapabilities(provider: OpenRouterVideoProvider) {

68+

const capabilities = provider.capabilities.generate;

69+

expect(capabilities).toBeDefined();

70+

if (!capabilities) {

71+

throw new Error("expected OpenRouter generate capabilities");

72+

}

73+

return capabilities;

74+

}

75+76+

function requireFetchCallHeaders(index: number): Headers {

77+

const call = fetchWithTimeoutGuardedMock.mock.calls[index];

78+

expect(call).toBeDefined();

79+

if (!call) {

80+

throw new Error(`expected OpenRouter fetch call ${index + 1}`);

81+

}

82+

const init = call[1] as { headers?: HeadersInit } | undefined;

83+

expect(init).toBeDefined();

84+

if (!init) {

85+

throw new Error(`expected OpenRouter fetch call ${index + 1} init`);

86+

}

87+

return new Headers(init.headers);

88+

}

89+90+

function requireGeneratedVideo(result: OpenRouterVideoResult, index: number) {

91+

const video = result.videos[index];

92+

expect(video).toBeDefined();

93+

if (!video) {

94+

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

95+

}

96+

return video;

97+

}

98+6499

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

65100

afterEach(() => {

66101

assertOkOrThrowHttpErrorMock.mockClear();

@@ -77,12 +112,13 @@ describe("openrouter video generation provider", () => {

77112

expectExplicitVideoGenerationCapabilities(provider);

78113

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

79114

expect(provider.defaultModel).toBe("google/veo-3.1-fast");

80-

expect(provider.capabilities.generate?.supportsAudio).toBe(true);

81-

expect(provider.capabilities.generate?.supportedDurationSeconds).toEqual([4, 6, 8]);

82-

expect(provider.capabilities.generate?.resolutions).toEqual(["720P", "1080P"]);

83-

expect(provider.capabilities.generate?.aspectRatios).toEqual(["16:9", "9:16"]);

84-

expect(provider.capabilities.imageToVideo?.enabled).toBe(true);

85-

expect(provider.capabilities.videoToVideo?.enabled).toBe(false);

115+

const generateCapabilities = requireGenerateCapabilities(provider);

116+

expect(generateCapabilities.supportsAudio).toBe(true);

117+

expect(generateCapabilities.supportedDurationSeconds).toEqual([4, 6, 8]);

118+

expect(generateCapabilities.resolutions).toEqual(["720P", "1080P"]);

119+

expect(generateCapabilities.aspectRatios).toEqual(["16:9", "9:16"]);

120+

expect(provider.capabilities.imageToVideo).toMatchObject({ enabled: true });

121+

expect(provider.capabilities.videoToVideo).toMatchObject({ enabled: false });

86122

});

8712388124

it("submits OpenRouter video jobs, polls completion, and downloads the result", async () => {

@@ -204,11 +240,7 @@ describe("openrouter video generation provider", () => {

204240

expect.any(Function),

205241

expect.objectContaining({ auditContext: "openrouter-video-status" }),

206242

);

207-

expect(

208-

(fetchWithTimeoutGuardedMock.mock.calls[0]?.[1]?.headers as Headers | undefined)?.get(

209-

"authorization",

210-

),

211-

).toBe("Bearer openrouter-key");

243+

expect(requireFetchCallHeaders(0).get("authorization")).toBe("Bearer openrouter-key");

212244

expect(fetchWithTimeoutGuardedMock).toHaveBeenNthCalledWith(

213245

2,

214246

"https://custom.openrouter.test/api/v1/videos/job-123/content?index=0",

@@ -217,13 +249,10 @@ describe("openrouter video generation provider", () => {

217249

expect.any(Function),

218250

expect.objectContaining({ auditContext: "openrouter-video-download" }),

219251

);

220-

expect(

221-

(fetchWithTimeoutGuardedMock.mock.calls[1]?.[1]?.headers as Headers | undefined)?.get(

222-

"authorization",

223-

),

224-

).toBe("Bearer openrouter-key");

225-

expect(result.videos[0]?.buffer?.toString()).toBe("mp4-bytes");

226-

expect(result.videos[0]?.mimeType).toBe("video/mp4");

252+

expect(requireFetchCallHeaders(1).get("authorization")).toBe("Bearer openrouter-key");

253+

const video = requireGeneratedVideo(result, 0);

254+

expect(video.buffer.toString()).toBe("mp4-bytes");

255+

expect(video.mimeType).toBe("video/mp4");

227256

expect(result.metadata).toEqual({

228257

jobId: "job-123",

229258

status: "completed",

@@ -266,11 +295,7 @@ describe("openrouter video generation provider", () => {

266295

expect.any(Function),

267296

expect.objectContaining({ auditContext: "openrouter-video-status" }),

268297

);

269-

expect(

270-

(fetchWithTimeoutGuardedMock.mock.calls[0]?.[1]?.headers as Headers | undefined)?.get(

271-

"authorization",

272-

),

273-

).toBeNull();

298+

expect(requireFetchCallHeaders(0).get("authorization")).toBeNull();

274299

expect(fetchWithTimeoutGuardedMock).toHaveBeenNthCalledWith(

275300

2,

276301

"https://cdn.openrouter.test/video.mp4",

@@ -279,11 +304,7 @@ describe("openrouter video generation provider", () => {

279304

expect.any(Function),

280305

expect.objectContaining({ auditContext: "openrouter-video-download" }),

281306

);

282-

expect(

283-

(fetchWithTimeoutGuardedMock.mock.calls[1]?.[1]?.headers as Headers | undefined)?.get(

284-

"authorization",

285-

),

286-

).toBeNull();

307+

expect(requireFetchCallHeaders(1).get("authorization")).toBeNull();

287308

});

288309289310

it("falls back to the documented content endpoint when a completed job has no output URL", async () => {

@@ -313,8 +334,9 @@ describe("openrouter video generation provider", () => {

313334

expect.any(Function),

314335

expect.objectContaining({ auditContext: "openrouter-video-download" }),

315336

);

316-

expect(result.videos[0]?.buffer?.toString()).toBe("webm-bytes");

317-

expect(result.videos[0]?.fileName).toBe("video-1.webm");

337+

const video = requireGeneratedVideo(result, 0);

338+

expect(video.buffer.toString()).toBe("webm-bytes");

339+

expect(video.fileName).toBe("video-1.webm");

318340

});

319341320342

it("rejects video reference inputs", async () => {