兼容旧草稿避免项目信息被清空
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user