兼容旧草稿避免项目信息被清空

This commit is contained in:
Cheng Zhou
2026-05-11 09:02:14 +08:00
parent f6a7a3d6ee
commit 8d061a1520
2 changed files with 19 additions and 1 deletions
@@ -50,6 +50,17 @@ describe("ProjectDetail setup draft publish workflow", () => {
expect(source.indexOf("applySetupDraft(createDefaultSetupDraft(siteOptions.value));", functionIndex)).toBe(-1);
});
it("does not let legacy empty projectInfo overwrite project master data", () => {
const source = readProjectDetail();
const functionIndex = source.indexOf("const applySetupDraft = (draft: SetupConfigDraft) => {");
const emptyGuardIndex = source.indexOf("!isProjectPublishSnapshotEmpty(projectInfo) || isSetupDraftEffectivelyEmpty(setupDraft)", functionIndex);
const fallbackIndex = source.indexOf("setupDraft.projectInfo = buildProjectPublishSnapshot();", emptyGuardIndex);
expect(functionIndex).toBeGreaterThan(-1);
expect(emptyGuardIndex).toBeGreaterThan(functionIndex);
expect(fallbackIndex).toBeGreaterThan(emptyGuardIndex);
});
it("keeps early termination out of regular visit schedule options", () => {
const source = readProjectDetail();