fix(*): 资源与技能 - 精简列表载荷并禁止对象存储静默降级

This commit is contained in:
ddcat666
2026-09-24 23:57:13 +08:00
parent 5528dbc3e4
commit d1acc8f6f3
16 changed files with 271 additions and 99 deletions

View File

@@ -1,6 +1,6 @@
import { describe, expect, test } from "bun:test";
import { changesRequireOSSRetest, DEFAULT_OSS_PATH_PREFIX, getS3PresetHints, normalizeOSSConnectionTestInput } from "../src/lib/oss-settings";
import { changesRequireOSSRetest, DEFAULT_OSS_PATH_PREFIX, getS3PresetHints, normalizeOSSConnectionTestInput, validateOSSConnectionDraft } from "../src/lib/oss-settings";
describe("OSS settings helpers", () => {
test("provides editable S3 endpoint hints for known presets", () => {
@@ -18,6 +18,11 @@ describe("OSS settings helpers", () => {
expect(DEFAULT_OSS_PATH_PREFIX).toBe("open-ai-canvas");
});
test("rejects a connection test draft without a bucket", () => {
expect(validateOSSConnectionDraft({ provider: "aliyun", bucket: " " })).toBe("请填写对象存储 Bucket");
expect(validateOSSConnectionDraft({ provider: "aliyun", bucket: "canvas-assets" })).toBe("");
});
test("normalizes a Tencent COS test draft when S3-only fields are not mounted", () => {
const input = normalizeOSSConnectionTestInput({
provider: "tencent",