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"; import { getEditorTemplatesMessages } from "@/features/i18n/messages/editorTemplates"; import { DEFAULT_LOCALE } from "@/features/i18n/locale"; // PublicPageRenderer 푸터 템플릿 TDD // - footerTemplate 로 생성한 섹션이 프리뷰에서 섹션/텍스트 구조로 올바르게 렌더되는지 검증한다. describe("PublicPageRenderer - 푸터 템플릿", () => { afterEach(() => { cleanup(); }); it("푸터 템플릿 섹션은 프리뷰에서 섹션과 푸터 텍스트들을 렌더해야 한다", () => { const sectionId = "footer_preview_section"; let i = 0; const createId = () => `footer_${++i}`; const tpl = getEditorTemplatesMessages(DEFAULT_LOCALE); const { blocks } = createFooterTemplateBlocks({ sectionId, createId, messages: tpl.footer }); render(); const section = screen.getByTestId("preview-section"); expect(section.getAttribute("data-section-id")).toBe(sectionId); expect(screen.getByText("MyLanding")).toBeTruthy(); expect(screen.getByText("The best choice for building better websites.")).toBeTruthy(); expect(screen.getByText(/Product/)).toBeTruthy(); expect(screen.getByText(/Contact/)).toBeTruthy(); expect(screen.getByText(/ 2025 MyLanding\./)).toBeTruthy(); }); });