diff --git a/src/features/tech-log/presentation/public/components/public-document-header.tsx b/src/features/tech-log/presentation/public/components/public-document-header.tsx index ed98b68..6f561c1 100644 --- a/src/features/tech-log/presentation/public/components/public-document-header.tsx +++ b/src/features/tech-log/presentation/public/components/public-document-header.tsx @@ -63,7 +63,9 @@ export function publicRenderModelBase( topic: { id: `topic-${record.topicSlug}`, label: record.topic, - publicPath: `/topics/${record.topicSlug}`, + // 공개 문서의 머리말이 실제로 그리는 주제 링크는 이 값이다 — 위의 breadcrumb 과 같은 + // 이유로 탐색 필터를 가리킨다. 둘 중 하나만 고치면 화면에서는 그대로 404 로 간다. + publicPath: `/explore?topic=${encodeURIComponent(record.topicSlug)}`, }, project: { id: `project-${record.projectSlug}`, diff --git a/tests/features/tech-log/public-document-screens.test.tsx b/tests/features/tech-log/public-document-screens.test.tsx index 132ec34..cc74846 100644 --- a/tests/features/tech-log/public-document-screens.test.tsx +++ b/tests/features/tech-log/public-document-screens.test.tsx @@ -42,6 +42,13 @@ const routeComponents = { type DocumentRouteId = keyof typeof routeComponents; +/** 머리말이 거는 주제 링크를 확인하기 위한 픽스처의 이름 → slug 대응. */ +const topicSlugs: Readonly> = { + JPA: "jpa", + Authentication: "authentication", + Redis: "redis", +}; + class NoopIntersectionObserver implements IntersectionObserver { readonly root = null; readonly rootMargin = "0px"; @@ -211,8 +218,16 @@ describe("TechLog canonical Public documents", () => { */ const [firstEvidence] = within(main).getAllByText(evidence, { exact: false }); expect(firstEvidence).toBeVisible(); - expect(within(main).getByRole("navigation", { name: "문서 경로" })).toHaveTextContent( - `${kind}/${topic}/${project}`, + const breadcrumb = within(main).getByRole("navigation", { name: "문서 경로" }); + expect(breadcrumb).toHaveTextContent(`${kind}/${topic}/${project}`); + /* + 글자만 보고 있었더니 주제 링크가 어디로 가는지는 아무도 묻지 않았다. 그 링크는 + `/topics/:slug` 를 가리켰고, 그 화면은 세 개의 주제를 하드코딩해 두고 있어 실제 주제는 + 무엇이든 404 였다 — 게시한 모든 문서가 죽은 링크를 하나씩 달고 있었다. + */ + expect(within(breadcrumb).getByRole("link", { name: topic })).toHaveAttribute( + "href", + `/explore?topic=${topicSlugs[topic]}`, ); /*