diff --git a/src/app/editor/page.tsx b/src/app/editor/page.tsx index c9bdf1d..1222313 100644 --- a/src/app/editor/page.tsx +++ b/src/app/editor/page.tsx @@ -899,7 +899,8 @@ function EditorPageInner() { const titleRaw = projectConfig?.title; const title = (typeof titleRaw === "string" ? titleRaw.trim() : "") || "제목 없음"; - const intervalMs = 20000; + const intervalEnv = process.env.NEXT_PUBLIC_EDITOR_SERVER_AUTOSAVE_MS; + const intervalMs = intervalEnv ? Number(intervalEnv) || 20000 : 20000; let cancelled = false; const saveOnce = async () => { diff --git a/tests/unit/EditorServerAutosave.spec.tsx b/tests/unit/EditorServerAutosave.spec.tsx index cc200fa..b32984d 100644 --- a/tests/unit/EditorServerAutosave.spec.tsx +++ b/tests/unit/EditorServerAutosave.spec.tsx @@ -69,14 +69,13 @@ beforeEach(() => { window.localStorage.clear(); searchParamsSlug = null; - - vi.useFakeTimers(); + (process.env as any).NEXT_PUBLIC_EDITOR_SERVER_AUTOSAVE_MS = "10"; }); afterEach(() => { cleanup(); - vi.useRealTimers(); vi.unstubAllGlobals(); + delete (process.env as any).NEXT_PUBLIC_EDITOR_SERVER_AUTOSAVE_MS; }); vi.mock("@/features/editor/state/editorStore", () => { @@ -153,8 +152,6 @@ describe("EditorPage - 서버 자동 저장", () => { ).toBe(true); }); - await vi.advanceTimersByTimeAsync(20000); - await waitFor(() => { expect( fetchMock.mock.calls.some( @@ -199,8 +196,6 @@ describe("EditorPage - 서버 자동 저장", () => { ).toBe(true); }); - await vi.advanceTimersByTimeAsync(20000); - const projectCalls = fetchMock.mock.calls.filter( ([url, options]: any[]) => url === "/api/projects" && (options?.method ?? "GET") === "POST", ); @@ -272,7 +267,14 @@ describe("EditorPage - 서버 자동 저장", () => { ).toBe(true); }); - await vi.advanceTimersByTimeAsync(20000); + await waitFor(() => { + expect( + fetchMock.mock.calls.some( + ([url, options]: any[]) => + url === "/api/projects" && (options?.method ?? "GET") === "POST", + ), + ).toBe(true); + }); const projectCall = fetchMock.mock.calls.find( ([url, options]: any[]) => url === "/api/projects" && (options?.method ?? "GET") === "POST", diff --git a/tests/unit/FormControllerPanel.spec.tsx b/tests/unit/FormControllerPanel.spec.tsx index f3a2d37..3371c36 100644 --- a/tests/unit/FormControllerPanel.spec.tsx +++ b/tests/unit/FormControllerPanel.spec.tsx @@ -178,7 +178,7 @@ describe("FormControllerPanel", () => { ).toBeTruthy(); }); - it("Google Sheets 가이드 모달의 Apps Script 코드가 컨트롤러에 매핑된 전송 키와 작성일시를 포함해야 한다", () => { + it("Google Sheets 가이드 모달의 Apps Script 코드가 컨트롤러에 매핑된 전송 키와 작성일시를 포함해야 한다", async () => { const formBlock = makeFormBlock("form-webhook", { submitTarget: "webhook", fieldIds: ["input-name", "input-email"], @@ -214,9 +214,9 @@ describe("FormControllerPanel", () => { ); const guideButton = screen.getByRole("button", { name: "Google Sheets 연동 가이드" }); - guideButton.click(); + fireEvent.click(guideButton); - const scriptTextarea = screen.getByDisplayValue(/function doPost/) as HTMLTextAreaElement; + const scriptTextarea = (await screen.findByDisplayValue(/function doPost/)) as HTMLTextAreaElement; expect(scriptTextarea.value).toContain("params.name || \"\""); expect(scriptTextarea.value).toContain("params.email || \"\""); diff --git a/uploads/556b2e0b-9206-4921-a394-f8b1e1210b3b b/uploads/556b2e0b-9206-4921-a394-f8b1e1210b3b new file mode 100644 index 0000000..87ccacf --- /dev/null +++ b/uploads/556b2e0b-9206-4921-a394-f8b1e1210b3b @@ -0,0 +1 @@ +dummy-video \ No newline at end of file diff --git a/uploads/test-image-1765104411326 b/uploads/test-image-1765104411326 new file mode 100644 index 0000000..0cc5db2 --- /dev/null +++ b/uploads/test-image-1765104411326 @@ -0,0 +1 @@ +dummy-image \ No newline at end of file diff --git a/uploads/test-section-bg-1765104411346 b/uploads/test-section-bg-1765104411346 new file mode 100644 index 0000000..0cc5db2 --- /dev/null +++ b/uploads/test-section-bg-1765104411346 @@ -0,0 +1 @@ +dummy-image \ No newline at end of file diff --git a/uploads/test-section-bg-video-1765104411371 b/uploads/test-section-bg-video-1765104411371 new file mode 100644 index 0000000..badc796 --- /dev/null +++ b/uploads/test-section-bg-video-1765104411371 @@ -0,0 +1 @@ +dummy-section-video \ No newline at end of file diff --git a/uploads/test-video-1765104411365 b/uploads/test-video-1765104411365 new file mode 100644 index 0000000..87ccacf --- /dev/null +++ b/uploads/test-video-1765104411365 @@ -0,0 +1 @@ +dummy-video \ No newline at end of file diff --git a/uploads/test-video-poster-1765104411337 b/uploads/test-video-poster-1765104411337 new file mode 100644 index 0000000..7285c92 --- /dev/null +++ b/uploads/test-video-poster-1765104411337 @@ -0,0 +1 @@ +dummy-poster \ No newline at end of file