Files
modelstudioai__cli/packages/commands/tests/e2e/text-chat.e2e.test.ts
clh02467605 1c38c381e5 feat: switch default text model to qwen3.8-max
Align text chat, pipeline, config UI, login validation, and Token Plan
text presets, and update README, skill reference, and related tests.
2026-08-03 15:34:18 +08:00

70 lines
2.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, test } from "vite-plus/test";
import { isDashScopeE2EReady, parseStdoutJson, runCommandE2e } from "./helpers.ts";
import { TEXT_CHAT_ROUTES } from "./topic-routes.ts";
/**
* Text chathelp / 分组不依赖密钥;对话需 DashScope。
*/
describe("e2e: text chat", () => {
test("text chat --help 正常退出", async () => {
const { stderr, exitCode } = await runCommandE2e(TEXT_CHAT_ROUTES, ["text", "chat", "--help"]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toMatch(/chat|--message|model|stream/i);
});
});
describe.skipIf(!isDashScopeE2EReady())("e2e: text chatDashScope", () => {
test("text chat 缺少 --message 时报用法错误并退出 (2)", async () => {
const { stderr, exitCode } = await runCommandE2e(TEXT_CHAT_ROUTES, [
"text",
"chat",
"--model",
"qwen3.8-max",
]);
expect(exitCode).toBe(2);
expect(stderr).toMatch(/--message|Usage:/i);
});
test("text chat --dry-run 仅输出 request 且不调对话接口", async () => {
const { stdout, stderr, exitCode } = await runCommandE2e(TEXT_CHAT_ROUTES, [
"text",
"chat",
"--dry-run",
"--model",
"qwen3.8-max",
"--message",
"干跑",
"--max-tokens",
"8",
"--output",
"json",
]);
expect(exitCode, stderr).toBe(0);
const data = parseStdoutJson<{
request?: { model?: string; messages?: Array<{ content?: string }> };
}>(stdout);
expect(data.request?.model).toBe("qwen3.8-max");
expect(data.request?.messages?.some((m) => m.content === "干跑")).toBe(true);
});
test("【qwen3.8-max】文本对话", async () => {
const { stdout, stderr, exitCode } = await runCommandE2e(TEXT_CHAT_ROUTES, [
"text",
"chat",
"--model",
"qwen3.8-max",
"--message",
"只回复一个字:好",
"--max-tokens",
"32",
"--output",
"json",
]);
expect(exitCode, stderr).toBe(0);
const data = parseStdoutJson<{ choices?: Array<{ message?: { content?: string } }> }>(stdout);
const text = data.choices?.[0]?.message?.content ?? "";
expect(text.length).toBeGreaterThan(0);
}, 120_000);
});