import { renderToStaticMarkup } from "react-dom/server"; import { describe, expect, it, vi } from "vitest"; import { CommentBoard } from "./comment-board"; import { CommentComposer } from "./comment-composer"; import { AdminCommentInbox } from "./admin-comment-inbox"; import type { CommentItem } from "@/lib/comments/types"; vi.mock("next/navigation", () => ({ useRouter: () => ({ push: vi.fn() }) })); const viewer = { id: "admin", admin: true, name: "Admin" }; const comment: CommentItem = { id: "test", rootId: null, replyToId: null, replyToName: null, authorName: "Author", authorImage: null, authorAdmin: false, text: "ข้อความของผู้ใช้", images: [], version: 2, createdAt: "2026-10-08T12:00:00Z", editedAt: "2026-10-08T12:00:00Z", hidden: false, ownHidden: false, deleted: false, hearted: false, likes: 0, reaction: 0, replyCount: 0, hasReplies: false, canEdit: true, canInteract: true, canModerate: true, target: "guide:test", targetName: "Test", targetImage: null, href: "/test/comment", }; describe("Thai comment UI", () => { it("keeps the public board in Thai", () => { const html = renderToStaticMarkup(); expect(html).toContain("ความคิดเห็น"); expect(html).toContain("เพิ่มความคิดเห็น…"); }); it("renders the admin inbox filters and empty state in Thai", () => { const html = renderToStaticMarkup(); expect(html).toContain("การตอบกลับจากผู้ดูแล"); expect(html).toContain("ไม่พบความคิดเห็นที่ตรงกัน"); expect(html).not.toContain("Admin replies"); expect(html).not.toContain("No matching comments"); }); it("renders editing controls in Thai while preserving the draft", () => { const html = renderToStaticMarkup( {}} />); expect(html).toContain("บันทึกการแก้ไข"); expect(html).toContain("แนบรูปภาพ"); expect(html).toContain(comment.text); }); });