폼전송 기능 수정
CI / test (push) Failing after 4m53s
CI / e2e (push) Has been skipped
CI / pr_and_merge (push) Has been skipped

This commit is contained in:
2025-12-07 19:11:06 +09:00
parent 96fa34cd86
commit 243083261f
27 changed files with 1025 additions and 5 deletions
+71
View File
@@ -151,4 +151,75 @@ describe("FormControllerPanel", () => {
// 기본 선택 값은 FormBlock.submitButtonId 이어야 한다.
expect(select.value).toBe("btn-1");
});
it("submitTarget 이 webhook 인 경우 Google Sheets 연동 가이드 텍스트를 보여줘야 한다", () => {
const formBlock = makeFormBlock("form-webhook", {
submitTarget: "webhook",
} as any);
const updateBlock = vi.fn();
render(
<FormControllerPanel
block={formBlock}
blocks={[formBlock]}
selectedBlockId="form-webhook"
updateBlock={updateBlock}
/>,
);
const guideButton = screen.getByRole("button", { name: "Google Sheets 연동 가이드" });
guideButton.click();
// Google Sheets 연동 가이드 헤딩과 Apps Script 안내 문구가 노출되어야 한다.
expect(screen.getByText("Google Sheets 연동 가이드")).toBeTruthy();
expect(
screen.getByText(/Apps Script 웹 앱 URL/i),
).toBeTruthy();
});
it("Google Sheets 가이드 모달의 Apps Script 코드가 컨트롤러에 매핑된 전송 키와 작성일시를 포함해야 한다", () => {
const formBlock = makeFormBlock("form-webhook", {
submitTarget: "webhook",
fieldIds: ["input-name", "input-email"],
} as any);
const inputNameBlock: Block = {
id: "input-name",
type: "formInput",
props: {
label: "이름",
formFieldName: "name",
} as any,
} as any;
const inputEmailBlock: Block = {
id: "input-email",
type: "formInput",
props: {
label: "이메일",
formFieldName: "email",
} as any,
} as any;
const updateBlock = vi.fn();
render(
<FormControllerPanel
block={formBlock}
blocks={[formBlock, inputNameBlock, inputEmailBlock]}
selectedBlockId="form-webhook"
updateBlock={updateBlock}
/>,
);
const guideButton = screen.getByRole("button", { name: "Google Sheets 연동 가이드" });
guideButton.click();
const scriptTextarea = screen.getByDisplayValue(/function doPost/) as HTMLTextAreaElement;
expect(scriptTextarea.value).toContain("params.name || \"\"");
expect(scriptTextarea.value).toContain("params.email || \"\"");
expect(scriptTextarea.value).toContain("new Date()");
});
});