슬러그 수정
CI / test (push) Successful in 4m56s
CI / e2e (push) Successful in 5m53s
CI / pr_and_merge (push) Has been skipped

This commit is contained in:
2025-12-07 20:57:19 +09:00
parent da3d71d124
commit b40be693ee
2 changed files with 5 additions and 17 deletions
+4 -17
View File
@@ -226,24 +226,11 @@ function EditorPageInner() {
return; return;
} }
const now = new Date(); const randomSlug = Array.from({ length: 12 }, () =>
const datePart = [ Math.floor(Math.random() * 36).toString(36),
now.getFullYear().toString().padStart(4, "0"), ).join("");
(now.getMonth() + 1).toString().padStart(2, "0"),
now.getDate().toString().padStart(2, "0"),
].join("");
const timePart = [ updateProjectConfig({ slug: randomSlug });
now.getHours().toString().padStart(2, "0"),
now.getMinutes().toString().padStart(2, "0"),
now.getSeconds().toString().padStart(2, "0"),
].join("");
const randomPart = Math.random().toString(36).slice(2, 6);
const generatedSlug = `page-${datePart}-${timePart}-${randomPart}`;
updateProjectConfig({ slug: generatedSlug });
}, [searchParams, projectConfig?.slug, updateProjectConfig]); }, [searchParams, projectConfig?.slug, updateProjectConfig]);
useEffect(() => { useEffect(() => {
+1
View File
@@ -169,6 +169,7 @@ describe("EditorPage - 서버 자동 저장", () => {
expect(typeof body.slug).toBe("string"); expect(typeof body.slug).toBe("string");
expect(body.slug).not.toBe("my-landing"); expect(body.slug).not.toBe("my-landing");
expect(body.slug.startsWith("page-")).toBe(false);
expect(mockState.projectConfig.slug).toBe(body.slug); expect(mockState.projectConfig.slug).toBe(body.slug);
}); });