import { describe, it, expect, afterEach } from "vitest"; import { render, screen, cleanup } from "@testing-library/react"; import { PublicPageRenderer } from "@/features/editor/components/PublicPageRenderer"; import { createFooterTemplateBlocks } from "@/app/editor/templates/footerTemplate"; import type { Block } from "@/features/editor/state/editorStore"; // PublicPageRenderer 푸터 템플릿 TDD // - footerTemplate 로 생성한 섹션이 프리뷰에서 섹션/텍스트 구조로 올바르게 렌더되는지 검증한다. describe("PublicPageRenderer - 푸터 템플릿", () => { afterEach(() => { cleanup(); }); it("푸터 템플릿 섹션은 프리뷰에서 섹션과 푸터 텍스트들을 렌더해야 한다", () => { const sectionId = "footer_preview_section"; let i = 0; const createId = () => `footer_${++i}`; const { blocks } = createFooterTemplateBlocks({ sectionId, createId }); render(); const section = screen.getByTestId("preview-section"); expect(section.getAttribute("data-section-id")).toBe(sectionId); expect(screen.getByText("MyLanding")).toBeTruthy(); expect(screen.getByText("더 나은 웹사이트를 위한 최고의 선택.")).toBeTruthy(); expect(screen.getByText(/서비스 소개/)).toBeTruthy(); expect(screen.getByText(/문의하기/)).toBeTruthy(); expect(screen.getByText(/© 2025 MyLanding\./)).toBeTruthy(); }); });