Files
modelstudioai__cli/packages/commands/tests/e2e/speech-list-voices.e2e.test.ts
clh02467605 d646a4e780 refactor(e2e): update test routes and streamline command handling
- Replaced hardcoded command paths with dynamic route mappings in E2E tests.
- Enhanced documentation for command testing, specifying minimum route requirements.
- Consolidated command path management into `topic-routes.ts` for better maintainability.
- Updated various E2E test cases to utilize the new routing structure, ensuring consistency across tests.
- Removed redundant helper functions and improved test clarity by directly referencing route exports.
2026-07-10 15:55:53 +08:00

54 lines
1.6 KiB
TypeScript

import { describe, expect, test } from "vite-plus/test";
import { isDashScopeE2EReady, runCommandE2e } from "./helpers.ts";
import { SPEECH_ROUTES } from "./topic-routes.ts";
/**
* Speech list-voices E2E
*/
describe("e2e: speech list-voices", () => {
test("speech synthesize --help 正常退出", async () => {
const { stderr, exitCode } = await runCommandE2e(SPEECH_ROUTES, [
"speech",
"synthesize",
"--help",
]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toMatch(/synthesize|--text|--voice|list-voices|model/i);
});
test("speech recognize --help 正常退出", async () => {
const { stderr, exitCode } = await runCommandE2e(SPEECH_ROUTES, [
"speech",
"recognize",
"--help",
]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toMatch(/recognize|--url|audio|model/i);
});
});
describe.skipIf(!isDashScopeE2EReady())("e2e: speech list-voices", () => {
test("speech synthesize 缺少 --text 且非 --list-voices 时报用法错误并退出 (2)", async () => {
const { stderr, exitCode } = await runCommandE2e(SPEECH_ROUTES, [
"speech",
"synthesize",
"--quiet",
]);
expect(exitCode).toBe(2);
expect(stderr).toMatch(/--text|Usage:/i);
});
test("【cosyvoice-v3-flash】获取音色列表", async () => {
const { stdout, stderr, exitCode } = await runCommandE2e(SPEECH_ROUTES, [
"speech",
"synthesize",
"--list-voices",
"--model",
"cosyvoice-v3-flash",
]);
expect(exitCode, stderr).toBe(0);
expect(stdout).toContain("longxiaochun_v3");
}, 60_000);
});