Files
modelstudioai__cli/packages/cli/tests/e2e/file-upload.e2e.test.ts
T
若麒 468b4d710e refactor(flags): scope yes/async/concurrent to command-owned flags
- remove nonInteractive plus yes/async/concurrent from GLOBAL_FLAGS and Settings;
  command dispatch no longer resolves command-only switches into global settings
- add shared ASYNC_FLAG / CONCURRENT_FLAG definitions for commands that actually
  support task-only return or parallel requests
- keep quota downgrade protection by moving --yes onto quota request and reading
  flags.yes for confirmed downgrade submission
- update existing async/concurrent consumers to read own flags; no new capability
  matrix entries are added
- refresh generated command reference and remove stale --non-interactive usage
  from e2e/stress invocations
2026-07-06 20:43:29 +08:00

61 lines
2.1 KiB
TypeScript
Raw 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 { dirname, join } from "path";
import { fileURLToPath } from "url";
import { isDashScopeE2EReady, parseStdoutJson, runCli } from "./helpers.ts";
const __dirname = dirname(fileURLToPath(import.meta.url));
/**
* File upload E2E
*/
describe("e2e: file upload", () => {
test("file 分组展示子命令帮助且成功退出", async () => {
const { stdout, stderr, exitCode } = await runCli(["file"]);
expect(exitCode, stderr).toBe(0);
const out = `${stdout}\n${stderr}`;
expect(out).toMatch(/file|upload/i);
});
test("file upload --help 正常退出", async () => {
const { stderr, exitCode } = await runCli(["file", "upload", "--help"]);
expect(exitCode, stderr).toBe(0);
expect(stderr).toMatch(/upload|--file|--model/i);
});
});
describe.skipIf(!isDashScopeE2EReady())("e2e: file uploadDashScope", () => {
test("file upload 缺少 --file 时报用法错误并退出 (2)", async () => {
const { stderr, exitCode } = await runCli(["file", "upload", "--model", "qwen3-vl-plus"]);
expect(exitCode).toBe(2);
expect(stderr).toMatch(/--file|Usage:/i);
});
test("file upload 缺少 --model 时报用法错误并退出 (2)", async () => {
const testFile = join(__dirname, ".smoke-32.png");
const { stderr, exitCode } = await runCli(["file", "upload", "--file", testFile]);
expect(exitCode).toBe(2);
expect(stderr).toMatch(/--model|Usage:/i);
});
test("上传文件成功返回oss临时 URL", async () => {
const testFile = join(__dirname, ".smoke-32.png");
const { stdout, stderr, exitCode } = await runCli([
"file",
"upload",
"--file",
testFile,
"--model",
"qwen3-vl-plus",
"--output",
"json",
]);
expect(exitCode, stderr).toBe(0);
const data = parseStdoutJson<{ url?: string; model?: string; expires_in?: string }>(stdout);
expect(data.url).toBeDefined();
expect(data.url).toMatch(/^oss:\/\//);
expect(data.model).toBe("qwen3-vl-plus");
expect(data.expires_in).toBe("48 hours");
}, 120_000);
});