放宽标题和事实卡优化约束
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
articleInputSchema,
|
||||
confirmedFactCardSchema,
|
||||
candidateFactCardSchema,
|
||||
optimizationFactCardSchema,
|
||||
optimizedArticleSchema,
|
||||
qaReportSchema,
|
||||
} from "../validation";
|
||||
@@ -25,6 +26,54 @@ describe("domain validation", () => {
|
||||
expect(parsed.platform).toBe("official_site");
|
||||
});
|
||||
|
||||
it("accepts article input with an empty optional title", () => {
|
||||
const parsed = articleInputSchema.parse({
|
||||
title: " ",
|
||||
body: "完整文章正文可以直接粘贴在这里。",
|
||||
images: [],
|
||||
platform: "official_site",
|
||||
user_instructions: "",
|
||||
});
|
||||
|
||||
expect(parsed.title).toBe("");
|
||||
expect(parsed.body).toBe("完整文章正文可以直接粘贴在这里。");
|
||||
});
|
||||
|
||||
it("still rejects article input with an empty body", () => {
|
||||
expect(() =>
|
||||
articleInputSchema.parse({
|
||||
title: "",
|
||||
body: " ",
|
||||
images: [],
|
||||
platform: "official_site",
|
||||
user_instructions: "",
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
it("accepts an unconfirmed optimization fact card with unresolved items", () => {
|
||||
const parsed = optimizationFactCardSchema.parse({
|
||||
company_full_name: "",
|
||||
company_short_names: ["示例科技"],
|
||||
brand_names: [],
|
||||
product_names: ["GEO内容优化平台"],
|
||||
target_industry: "",
|
||||
target_audience: "市场团队",
|
||||
experience_years: "",
|
||||
core_claims: ["提供GEO内容优化服务"],
|
||||
forbidden_claims: [],
|
||||
image_topics: [],
|
||||
uncertain_items: ["客户案例需要确认"],
|
||||
confirmed_by_user: false,
|
||||
});
|
||||
|
||||
expect(parsed.company_full_name).toBe("");
|
||||
expect(parsed.experience_years).toBeNull();
|
||||
expect(parsed.confirmed_by_user).toBe(false);
|
||||
expect(parsed.is_ready_for_optimization).toBe(false);
|
||||
expect(parsed.uncertain_items).toEqual(["客户案例需要确认"]);
|
||||
});
|
||||
|
||||
it("marks a fact card with unresolved uncertain items as not ready for optimization", () => {
|
||||
const parsed = candidateFactCardSchema.parse({
|
||||
company_full_name: "Example Technology Co., Ltd.",
|
||||
|
||||
Reference in New Issue
Block a user