form export 수정 및 통합테스트
This commit is contained in:
@@ -65,6 +65,11 @@ describe("/api/export", () => {
|
||||
expect(cssEntry).toBeTruthy();
|
||||
expect(jsEntry).toBeTruthy();
|
||||
|
||||
const mainJs = await jsEntry!.async("string");
|
||||
expect(mainJs).toContain("pbInitFormControllers");
|
||||
expect(mainJs).toContain('querySelectorAll("form.pb-form-controller")');
|
||||
expect(mainJs).toContain("fetch(");
|
||||
|
||||
const html = await indexEntry!.async("string");
|
||||
expect(html).toContain("<title>내보내기 테스트 페이지</title>");
|
||||
expect(html).toContain("ZIP 내보내기 테스트");
|
||||
@@ -475,6 +480,7 @@ describe("/api/export", () => {
|
||||
// - <form id="form_form_1" ...>
|
||||
const formId = "form_form_1";
|
||||
expect(html).toMatch(new RegExp(`<form[^>]*id=\\"${formId}\\"`));
|
||||
expect(html).toMatch(new RegExp(`<form[^>]*id=\\"${formId}\\"[^>]*action=\\"/api/forms/submit\\"`));
|
||||
|
||||
// 컨트롤러 필드 블록(formInput/formSelect) 이 렌더한 input/select 는 각각 name 과 form 속성을 가져야 한다.
|
||||
// name="name" input 은 required + form="form_form_1" 이어야 한다.
|
||||
@@ -489,6 +495,7 @@ describe("/api/export", () => {
|
||||
const formHtml = html.slice(formStart, formEnd);
|
||||
expect(formHtml).not.toContain('name="name"');
|
||||
expect(formHtml).not.toContain('name="plan"');
|
||||
expect(formHtml).toContain('name="__config"');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user