|
| 1 | +import { writeFileSync } from "node:fs"; |
| 2 | +import { join } from "node:path"; |
1 | 3 | import { describe, expect, test } from "vite-plus/test"; |
2 | | -import { isDashScopeE2EReady, runCommandHelp, runCommandE2e } from "./helpers.ts"; |
| 4 | +import { isDashScopeE2EReady, makeE2eOutputDir, runCommandHelp, runCommandE2e } from "./helpers.ts"; |
3 | 5 | import { SPEECH_ROUTES } from "./topic-routes.ts"; |
4 | 6 |
|
5 | 7 | /** |
@@ -57,6 +59,35 @@ describe("e2e: speech list-voices", () => { |
57 | 59 | expect(stdout).toContain("longanfengyue"); |
58 | 60 | expect(stdout).toContain("loongjohn"); |
59 | 61 | }); |
| 62 | + |
| 63 | + // 激活 token-plan 后不传 --model,应打出默认 qwen-audio plus 音色 |
| 64 | + test("Token Plan 未显式传 --model 时 --list-voices 使用默认 qwen-audio TTS", async () => { |
| 65 | + const configDir = makeE2eOutputDir("speech-list-voices-token-plan-default"); |
| 66 | + writeFileSync( |
| 67 | + join(configDir, "config.json"), |
| 68 | + JSON.stringify({ |
| 69 | + "token-plan": { |
| 70 | + api_key: "sk-sp-e2e-placeholder", |
| 71 | + base_url: "https://token-plan.cn-beijing.maas.aliyuncs.com", |
| 72 | + default_speech_model: "qwen-audio-3.0-tts-plus", |
| 73 | + }, |
| 74 | + }), |
| 75 | + ); |
| 76 | + |
| 77 | + const { stdout, stderr, exitCode } = await runCommandE2e( |
| 78 | + SPEECH_ROUTES, |
| 79 | + ["speech", "synthesize", "--config", "token-plan", "--list-voices"], |
| 80 | + { |
| 81 | + BAILIAN_CONFIG_DIR: configDir, |
| 82 | + DASHSCOPE_API_KEY: "", |
| 83 | + DASHSCOPE_BASE_URL: "", |
| 84 | + }, |
| 85 | + ); |
| 86 | + |
| 87 | + expect(exitCode, stderr).toBe(0); |
| 88 | + expect(stdout).toContain("longanlingxin"); |
| 89 | + expect(stdout).toContain("longanlufeng"); |
| 90 | + }); |
60 | 91 | }); |
61 | 92 |
|
62 | 93 | describe.skipIf(!isDashScopeE2EReady())("e2e: speech list-voices", () => { |
|
0 commit comments