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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
博客园_首页
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
V
V2EX
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队

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

@@ -332,6 +332,26 @@ describe("buildMinimaxSpeechProvider", () => {

332332

await rm(tempStateDir, { recursive: true, force: true });

333333

});

334334335+

function firstFetchCall(): unknown[] {

336+

const call = vi.mocked(globalThis.fetch).mock.calls.at(0);

337+

if (!call) {

338+

throw new Error("Expected MiniMax TTS fetch call");

339+

}

340+

return call as unknown[];

341+

}

342+343+

function firstFetchInit(): RequestInit | undefined {

344+

return firstFetchCall().at(1) as RequestInit | undefined;

345+

}

346+347+

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

348+

const init = firstFetchInit();

349+

if (typeof init?.body !== "string") {

350+

throw new Error("Expected MiniMax TTS fetch init body");

351+

}

352+

return JSON.parse(init.body) as Record<string, unknown>;

353+

}

354+335355

it("makes correct API call and decodes hex response", async () => {

336356

const hexAudio = Buffer.from("fake-audio-data").toString("hex");

337357

const mockFetch = vi.mocked(globalThis.fetch);

@@ -356,15 +376,14 @@ describe("buildMinimaxSpeechProvider", () => {

356376

expect(result.audioBuffer.toString()).toBe("fake-audio-data");

357377358378

expect(mockFetch).toHaveBeenCalledOnce();

359-

const [url, init] = mockFetch.mock.calls[0];

379+

const url = firstFetchCall().at(0);

360380

expect(url).toBe("https://api.minimaxi.com/v1/t2a_v2");

361-

if (!init?.body) {

362-

throw new Error("Expected MiniMax TTS fetch init body");

363-

}

364-

const body = JSON.parse(init.body as string);

381+

const body = firstFetchBody();

365382

expect(body.model).toBe("speech-2.8-hd");

366383

expect(body.text).toBe("Hello world");

367-

expect(body.voice_setting.voice_id).toBe("English_expressive_narrator");

384+

expect((body.voice_setting as Record<string, unknown>).voice_id).toBe(

385+

"English_expressive_narrator",

386+

);

368387

expect(transcodeAudioBufferToOpusMock).not.toHaveBeenCalled();

369388

});

370389

@@ -421,12 +440,13 @@ describe("buildMinimaxSpeechProvider", () => {

421440

timeoutMs: 30000,

422441

});

423442424-

const body = JSON.parse(vi.mocked(globalThis.fetch).mock.calls[0][1]!.body as string);

443+

const body = firstFetchBody();

425444

expect(body.model).toBe("speech-01-240228");

426-

expect(body.voice_setting.voice_id).toBe("custom_voice");

427-

expect(body.voice_setting.speed).toBe(1.5);

428-

expect(body.voice_setting.vol).toBe(1.5);

429-

expect(body.voice_setting.pitch).toBe(0);

445+

const voiceSetting = body.voice_setting as Record<string, unknown>;

446+

expect(voiceSetting.voice_id).toBe("custom_voice");

447+

expect(voiceSetting.speed).toBe(1.5);

448+

expect(voiceSetting.vol).toBe(1.5);

449+

expect(voiceSetting.pitch).toBe(0);

430450

});

431451432452

it("uses a MiniMax Token Plan env var when no API key is configured", async () => {

@@ -444,7 +464,7 @@ describe("buildMinimaxSpeechProvider", () => {

444464

timeoutMs: 30000,

445465

});

446466447-

const [, init] = vi.mocked(globalThis.fetch).mock.calls[0];

467+

const init = firstFetchInit();

448468

expect(init?.headers).toEqual({

449469

Authorization: "Bearer sk-cp-env",

450470

"Content-Type": "application/json",

@@ -485,7 +505,8 @@ describe("buildMinimaxSpeechProvider", () => {

485505

timeoutMs: 30000,

486506

});

487507488-

const [url, init] = vi.mocked(globalThis.fetch).mock.calls[0];

508+

const url = firstFetchCall().at(0);

509+

const init = firstFetchInit();

489510

expect(url).toBe("https://api.minimaxi.com/v1/t2a_v2");

490511

expect(init?.headers).toEqual({

491512

Authorization: "Bearer portal-token",