diff --git a/public/release-manifest.json b/public/release-manifest.json index 61f9f0f..55bbb19 100644 --- a/public/release-manifest.json +++ b/public/release-manifest.json @@ -38,28 +38,28 @@ }, "contractSet": { "setAlgorithm": "CA_CONTRACT_SET_V1", - "setDigest": "sha256:316028ca9b408cd5e943f1971792fbdb843392ea51ae415815fbbb8701d03909", + "setDigest": "sha256:6547e98a79ff5e09afeac849036d559481fc8abc6e232a2b5ce5c9841a071a25", "packages": [ { "packageId": "@tech-log/management-contract", "version": "1.0.0", "digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8", "runtimeProtocolVersion": 1, - "sourceRevision": "71bab4c" + "sourceRevision": "a58ad30" }, { "packageId": "@tech-log/public-contract", "version": "2.1.0", - "digest": "sha256:977edf6707dc41a92f58f0f42908864ab8a3c1991d08f5c598319d51dac65235", + "digest": "sha256:a964914040740a1223c33b5aeaf7724a8a0c78d91063bf3f1b7d7594c314a395", "runtimeProtocolVersion": 1, - "sourceRevision": "71bab4c" + "sourceRevision": "a58ad30" }, { "packageId": "@tech-log/studio-contract", "version": "3.1.0", "digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c", "runtimeProtocolVersion": 1, - "sourceRevision": "71bab4c" + "sourceRevision": "a58ad30" } ] } diff --git a/src/features/tech-log/adapters/http/public-content-mapping.ts b/src/features/tech-log/adapters/http/public-content-mapping.ts index f523c64..73d2796 100644 --- a/src/features/tech-log/adapters/http/public-content-mapping.ts +++ b/src/features/tech-log/adapters/http/public-content-mapping.ts @@ -221,11 +221,26 @@ export function baseOf( * for free; it is a real extra request now, and the alternative — widening the * list response — would send every body to render a title. */ +/** + * 지식 목록이 싣는 종류. 계약의 `KnowledgeListItem.type` 과 같은 집합이어야 한다. + * + *

여기가 삼항이던 동안 개념은 어디에도 없어 `null` 로 버려졌다. 서버는 개념을 보내고 탐색 + * 필터에는 「동작 원리」가 있는데 결과는 0건이었다 — 독자에게는 기록이 없는 것으로 보였다. + * 손으로 나열한 목록에 개념을 빠뜨리는 일이 이 저장소에서 반복됐고, 이 자리가 마지막이다. + */ +const KNOWLEDGE_LIST_KINDS: Record = { + CASE: "CASE", + CONCEPT: "CONCEPT", + REFERENCE: "REFERENCE", +}; + export function knowledgeListItemToRecord(item: Readonly>): PublicRecord | null { const type = String(item.type ?? ""); + const kind = KNOWLEDGE_LIST_KINDS[type]; + if (!kind) return null; const path = String(item.path ?? ""); const slug = path.split("/").filter(Boolean).pop() ?? ""; - const base = baseOf(type === "REFERENCE" ? "REFERENCE" : "CASE", slug, { + const base = baseOf(kind, slug, { title: item.title as string, summary: (item.primarySummary as string) ?? "", path, @@ -248,6 +263,17 @@ export function knowledgeListItemToRecord(item: Readonly sections: Object.freeze([]), }) as CaseRecord; } + if (type === "CONCEPT") { + return Object.freeze({ + ...base, + kind: "CONCEPT", + basisVersion: "", + // 목록 항목은 본문을 담지 않는다 — 본문은 상세 조회에서만 온다. + content: "", + bodyAssets: Object.freeze([]), + sections: Object.freeze([]), + }) as ConceptRecord; + } if (type === "REFERENCE") { return Object.freeze({ ...base, @@ -322,6 +348,8 @@ export function questionListItemToRecord(item: Readonly> summary: (item.summary as string) ?? "", path, primaryProject: item.primaryProject as Summary, + // 계약이 이제 질문 목록에도 주제를 준다. 없던 동안 목록의 질문 줄만 「· 프로젝트」로 시작했다. + primaryTopic: item.primaryTopic as Summary, publishedAt: item.updatedAt as string, }), kind: "QUESTION", diff --git a/src/features/tech-log/contracts/management/canonical-source.json b/src/features/tech-log/contracts/management/canonical-source.json index 3164b75..f1bbd5a 100644 --- a/src/features/tech-log/contracts/management/canonical-source.json +++ b/src/features/tech-log/contracts/management/canonical-source.json @@ -2,7 +2,7 @@ "packageId": "@tech-log/management-contract", "version": "1.0.0", "digest": "sha256:61f8360cfb2e638c5d8c5557434b564e39cea517464c33cedcd1c5bf39a58aa8", - "sourceRevision": "71bab4c", + "sourceRevision": "a58ad30", "operationIds": [ "createCaseDraft", "getCaseForEdit", diff --git a/src/features/tech-log/contracts/public/canonical-source.json b/src/features/tech-log/contracts/public/canonical-source.json index bf8d3a6..a6a31b2 100644 --- a/src/features/tech-log/contracts/public/canonical-source.json +++ b/src/features/tech-log/contracts/public/canonical-source.json @@ -1,8 +1,8 @@ { "packageId": "@tech-log/public-contract", "version": "2.1.0", - "digest": "sha256:977edf6707dc41a92f58f0f42908864ab8a3c1991d08f5c598319d51dac65235", - "sourceRevision": "71bab4c", + "digest": "sha256:a964914040740a1223c33b5aeaf7724a8a0c78d91063bf3f1b7d7594c314a395", + "sourceRevision": "a58ad30", "operationIds": [ "getPublicSite", "getPublicHome", diff --git a/src/features/tech-log/contracts/public/generated.ts b/src/features/tech-log/contracts/public/generated.ts index 145273f..dd048f4 100644 --- a/src/features/tech-log/contracts/public/generated.ts +++ b/src/features/tech-log/contracts/public/generated.ts @@ -523,6 +523,11 @@ export interface components { currentUnderstanding?: string; nextVerification?: string; primaryProject?: components["schemas"]["ProjectSummary"]; + /** @description 이 질문이 속한 주제. 지식 목록(`KnowledgeListItem`)은 처음부터 이것을 싣고 있었는데 + * 질문 목록만 빠져 있어서, 같은 목록에 섞여 나오는 질문 줄만 맥락이 「· 프로젝트」로 + * 시작했다. 주제로 거르는 것은 서버가 이미 하고 있었다 — 보여 줄 값만 없었다. + * */ + primaryTopic?: components["schemas"]["TopicSummary"]; /** Format: date-time */ updatedAt: string; }; diff --git a/src/features/tech-log/contracts/public/public-api.openapi.yaml b/src/features/tech-log/contracts/public/public-api.openapi.yaml index 140e418..4f0e4d0 100644 --- a/src/features/tech-log/contracts/public/public-api.openapi.yaml +++ b/src/features/tech-log/contracts/public/public-api.openapi.yaml @@ -1181,6 +1181,13 @@ components: type: string primaryProject: $ref: '#/components/schemas/ProjectSummary' + primaryTopic: + allOf: + - $ref: '#/components/schemas/TopicSummary' + description: | + 이 질문이 속한 주제. 지식 목록(`KnowledgeListItem`)은 처음부터 이것을 싣고 있었는데 + 질문 목록만 빠져 있어서, 같은 목록에 섞여 나오는 질문 줄만 맥락이 「· 프로젝트」로 + 시작했다. 주제로 거르는 것은 서버가 이미 하고 있었다 — 보여 줄 값만 없었다. updatedAt: *id003 QuestionPage: type: object diff --git a/src/features/tech-log/contracts/studio/canonical-source.json b/src/features/tech-log/contracts/studio/canonical-source.json index 0622eed..b2d6621 100644 --- a/src/features/tech-log/contracts/studio/canonical-source.json +++ b/src/features/tech-log/contracts/studio/canonical-source.json @@ -2,7 +2,7 @@ "packageId": "@tech-log/studio-contract", "version": "3.1.0", "digest": "sha256:d2bfbe0a12136f131ccb8c42f8868108ba8d0f0182b347f9b815316c343a970c", - "sourceRevision": "71bab4c", + "sourceRevision": "a58ad30", "operationIds": [ "getStudioSession", "getStudioDashboard", diff --git a/src/features/tech-log/presentation/public/components/home-focus.tsx b/src/features/tech-log/presentation/public/components/home-focus.tsx index 0268661..b6d99dc 100644 --- a/src/features/tech-log/presentation/public/components/home-focus.tsx +++ b/src/features/tech-log/presentation/public/components/home-focus.tsx @@ -112,6 +112,7 @@ export function HomeFocus({ {renderedItems.map((item) => { const selected = item.key === activeKey; + const shown = item.details.filter((detail) => detail.value.trim() !== ""); return (

{item.title}

-

{cardSummary(item.summary)}

+ {/* 프로젝트 한 줄 설명이 비어 있을 수 있다 — 그때는 빈 문단을 두지 않는다. */} + {item.summary.trim() ?

{cardSummary(item.summary)}

: null} 작업 맥락 보기
-
- {item.details.map((detail) => ( -
-
{detail.label}
-
{detail.value}
-
- ))} -
+ {/* + 값이 없는 항목은 그리지 않는다. 「현재 목표」·「다음 작업」을 아직 적지 않은 + 프로젝트에서 라벨과 구분선만 남아 빈 칸 두 개가 화면에 있었다 — 비어 있다는 사실을 + 보여 줄 이유가 없는 자리다. + */} + {shown.length > 0 ? ( +
+ {shown.map((detail) => ( +
+
{detail.label}
+
{detail.value}
+
+ ))} +
+ ) : null}
); })} diff --git a/src/features/tech-log/presentation/public/pages/home-page.tsx b/src/features/tech-log/presentation/public/pages/home-page.tsx index 8b28835..e1c21c2 100644 --- a/src/features/tech-log/presentation/public/pages/home-page.tsx +++ b/src/features/tech-log/presentation/public/pages/home-page.tsx @@ -49,23 +49,37 @@ function optionalString(value: unknown): string | undefined { * 릴리스는 Publication 파이프라인을 거치지 않아 그 투영에 행이 없다. 그래서 릴리스만 따로 읽어 * 시간순으로 합친다. */ -const latestTypeLabels: Readonly> = { - PROJECT_ACTIVITY: "PROJECT ACTIVITY", - QUESTION: "OPEN QUESTION", +/** + * 최근 기록 한 줄이 다는 이름. + * + *

이 표가 영문 대문자를 그대로 흘려보내던 동안 홈 한 화면에 종류 이름이 아홉 개 떠 있었다 — + * 목록에는 `CASE`·`CONCEPT`·`OPEN QUESTION`·`REFERENCE`, 바로 아래 「종류별로 읽기」에는 + * 「검증 기록」·「동작 원리」·「적용 기준」·「열린 질문」. 독자는 둘이 같은 것이라는 단서를 + * 어디서도 받지 못했다. 이름을 바꾸기 전보다 나빠진 유일한 자리였다. + * + *

기록의 네 종류는 공용 표에서 가져온다. 프로젝트 활동만 여기 따로 적는다 — 기록이 아니라 + * 프로젝트에서 일어난 일이라 `RecordKind` 에 없다. + */ +const NOT_A_RECORD_LABELS: Readonly> = { + PROJECT_ACTIVITY: "프로젝트 활동", }; +function latestTypeLabel(entryType: string): string { + if (entryType in DOCUMENT_KIND_LABELS) { + return DOCUMENT_KIND_LABELS[entryType as keyof typeof DOCUMENT_KIND_LABELS]; + } + return NOT_A_RECORD_LABELS[entryType] ?? entryType; +} + async function getLatestEntries( publicContent: PublicContentQueries, ): Promise { - const [records, searchableEntities] = await Promise.all([ - publicContent.getLatestEntries(), - publicContent.searchPublicContent(""), - ]); + const records = await publicContent.getLatestEntries(); const recordTimeline: LatestEntry[] = records.map((entry) => ({ id: entry.id, // 목록의 다른 이름들과 같은 자리에 놓이므로 표기도 같은 규칙을 쓴다 — 대문자에 공백. - typeLabel: latestTypeLabels[entry.entryType] ?? entry.entryType, + typeLabel: latestTypeLabel(entry.entryType), title: entry.title, summary: entry.summary, date: dateLabel(entry.publishedAt), @@ -75,39 +89,23 @@ async function getLatestEntries( path: entry.path, })); - const releaseTimeline = ( - await Promise.all( - searchableEntities - .filter((entity) => entity.contentType === "RELEASE") - .map(async (entity) => { - const prefix = "/releases/"; - if (!entity.path.startsWith(prefix)) return []; - const release = await publicContent.getRelease( - decodeURIComponent(entity.path.slice(prefix.length)), - ); - if (!release) return []; - return [ - { - id: `release-${release.version}`, - typeLabel: "RELEASE", - title: release.title, - summary: release.summary, - date: release.publishedLabel, - dateTime: release.publishedAt, - topic: "TechLog", - project: "TechLog", - path: release.path, - }, - ]; - }), - ) - ).flat(); + /* + 릴리스는 넣지 않는다. 변경 기록은 이 기록의 읽을거리가 아니라 사이트 자체의 이력이라 + 주 내비에서 뺐는데, 홈 목록에는 그대로 섞여 있었다 — 같은 판단이 한 자리에만 적용돼 있었다. + `/releases` 는 그대로 살아 있고 릴리스 화면에서 읽는다. - return [...recordTimeline, ...releaseTimeline].sort((left, right) => - right.dateTime.localeCompare(left.dateTime), - ); + 그리고 앞의 몇 편만 보인다. 주제 허브가 생긴 지금 홈이 할 일은 목록을 통째로 펴 두는 것이 + 아니라 「무엇을 견줬나」와 「지금 무엇을 하고 있나」를 보여 주는 것이다 — 목록이 홈의 절반을 + 차지하면 그 둘이 스크롤 아래로 밀린다. + */ + return [...recordTimeline] + .sort((left, right) => right.dateTime.localeCompare(left.dateTime)) + .slice(0, LATEST_ON_HOME); } +/** 홈이 펴 두는 최근 기록 수. 나머지는 「모든 기록 탐색」이 받는다. */ +const LATEST_ON_HOME = 4; + /** 목록의 날짜 칸은 공개 화면 어디서나 같은 형식이다. */ function dateLabel(isoTimestamp: string): string { const parsed = new Date(isoTimestamp); diff --git a/src/features/tech-log/presentation/public/pages/topic-page.tsx b/src/features/tech-log/presentation/public/pages/topic-page.tsx index 0aa2823..db6fb47 100644 --- a/src/features/tech-log/presentation/public/pages/topic-page.tsx +++ b/src/features/tech-log/presentation/public/pages/topic-page.tsx @@ -4,9 +4,46 @@ import { } from "../../../../../presentation/routes/route-input.tsx"; import { PublicDocumentRelations } from "../../shared/public-render/public-document-relations.tsx"; import { ProseText } from "../../shared/public-render/prose-text.tsx"; +import type { + PublicRecord, + RecordKind, +} from "../../../application/ports/public-content-queries.ts"; +import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; import { PublicRecordList } from "../components/public-record-list.tsx"; import { usePublicContent } from "../use-public-content.tsx"; +/** + * 읽는 순서. + * + *

서버가 주는 대표 기록(`featuredCases`/`featuredReference`)은 작성자가 주제마다 손으로 + * 골라 두는 값이라 대부분 비어 있다. 비어 있으면 열린 질문만 남아, 아직 답이 없는 질문 넷을 + * 모아 두고 「먼저 읽을 것」이라 부르게 된다 — 처음 온 사람에게 가장 나쁜 첫 화면이다. + * + *

그래서 기록 자체에서 순서를 만든다. 원리를 먼저 알고, 그것을 확인한 기록을 보고, 거기서 + * 나온 기준을 읽고, 아직 답하지 못한 것을 마지막에 본다. + * + *

서버의 대표 값을 쓰지 않는 이유는 그것이 순서가 아니라 통 두 개(대표 Case · 열린 질문)라 + * 서다. 통을 이어 붙이면 기준이 통째로 빠지고, 채워져 있는 쪽이 질문뿐일 때는 질문만 남는다. + */ +const READING_ORDER: ReadonlyArray = ["CONCEPT", "CASE", "REFERENCE", "QUESTION"]; + +/** 한 종류에서 앞의 몇 편까지. 넘으면 순서가 아니라 목록이 된다. */ +const PER_KIND = 2; + +function firstReads(records: ReadonlyArray) { + return READING_ORDER.flatMap((kind) => + records + .filter((record) => record.kind === kind) + .slice(0, PER_KIND) + .map((record) => ({ + label: DOCUMENT_KIND_LABELS[record.kind], + title: record.title, + path: record.path, + summary: record.summary, + })), + ); +} + /** * 주제 한 편. * @@ -31,6 +68,9 @@ export function TopicPage() { if (!topic) return ; const axisLabel = topic.variantLabel.trim() || "접근"; + const readingOrder = firstReads(records); + const readingPaths = new Set(readingOrder.map((entry) => entry.path)); + const rest = records.filter((record) => !readingPaths.has(record.path)); return (

@@ -47,6 +87,14 @@ export function TopicPage() {

{axisLabel}

{`${axisLabel}별로 무엇을 알게 됐나`}

+ {/* + 오른쪽 숫자를 더해도 아래 목록의 개수와 맞지 않는다. 한 기록이 여러 축에 걸릴 수 + 있고, 어느 축에도 걸리지 않은 기록은 공통이기 때문이다 — 그 규칙을 화면이 말하지 + 않으면 독자는 빠진 기록이 있다고 읽는다. + */} +

+ {`한 기록이 여러 ${axisLabel}에 걸릴 수 있고, 어디에도 걸리지 않은 기록은 이 주제의 공통 기록입니다.`} +

    {topic.variants.map((variant) => ( /* @@ -72,16 +120,20 @@ export function TopicPage() { ) : null} + {/* + 먼저 읽을 것에 오른 편은 여기서 뺀다. 예전에는 같은 네 편이 위아래로 두 번 나왔다 — + 「먼저 읽을 것」이 목록의 앞부분을 복사한 것처럼 보이면 순서를 정해 준 뜻이 없어진다. + */}
    -

    관련 기록

    -

    {`${records.length}개의 관련 기록`}

    +

    나머지 기록

    +

    {`${rest.length}개`}

    - + 매퍼가 CASE 와 REFERENCE 만 알던 동안 개념은 `null` 로 버려졌다. 서버는 개념을 보내고 + * 탐색 필터에는 「동작 원리」가 있는데 결과는 0건이었다 — 독자에게는 기록이 없는 것으로 + * 보였고, 필터에 있는데 결과가 없으니 오해가 남았다. + * + *

    기대 목록을 손으로 적지 않고 계약에서 읽는다. 종류가 늘면 여기서 먼저 멈춘다. + */ +const CONTRACT = readFileSync( + "src/features/tech-log/contracts/public/public-api.openapi.yaml", + "utf8", +); + +function contractKnowledgeKinds(): string[] { + const block = /\n {4}KnowledgeListItem:[\s\S]*?(?=\n {4}[A-Z]\w+:)/u.exec(CONTRACT)?.[0] ?? ""; + const typeBlock = /\n {8}type:\n {10}type: string\n {10}enum:\n((?: {10}- \w+\n)+)/u.exec(block); + return [...(typeBlock?.[1] ?? "").matchAll(/- (\w+)/gu)].map((match) => match[1]!); +} + +test("계약이 보내는 지식 종류를 매퍼가 하나도 버리지 않는다", () => { + const kinds = contractKnowledgeKinds(); + assert.deepEqual( + [...kinds].sort(), + ["CASE", "CONCEPT", "REFERENCE"], + "계약이 보내는 종류가 바뀌었다 — 매퍼의 표도 함께 봐야 한다", + ); + + for (const type of kinds) { + const record = knowledgeListItemToRecord({ + type, + title: "제목", + path: `/x/${type.toLowerCase()}`, + primarySummary: "요약", + publishedAt: "2026-01-01T00:00:00Z", + primaryTopic: { name: "주제", slug: "topic" }, + primaryProject: { name: "프로젝트", slug: "project" }, + }); + assert.ok(record, `${type} 이 목록에서 버려진다`); + assert.equal(record.kind, type, `${type} 이 다른 종류로 읽힌다`); + // 맥락 줄이 이 두 값을 읽는다. 비면 「· 프로젝트」처럼 앞이 잘린 줄이 남는다. + assert.equal(record.topic, "주제"); + assert.equal(record.projectTitle, "프로젝트"); + } +}); diff --git a/tests/features/tech-log/public-discovery-screens.test.tsx b/tests/features/tech-log/public-discovery-screens.test.tsx index 4336f13..f51189d 100644 --- a/tests/features/tech-log/public-discovery-screens.test.tsx +++ b/tests/features/tech-log/public-discovery-screens.test.tsx @@ -160,6 +160,11 @@ describe("TechLog home discovery", () => { ); } + /* + 홈은 앞의 몇 편만 편다. 주제 허브가 생긴 지금 홈이 할 일은 목록을 통째로 펴 두는 것이 + 아니라 무엇을 견줬고 지금 무엇을 하고 있는지를 보여 주는 것이다 — 목록이 홈의 절반을 + 차지하면 그 둘이 스크롤 아래로 밀린다. + */ const latest = screen.getByRole("region", { name: "최근 기록" }); expect( within(latest).getAllByRole("heading", { level: 3 }).map((heading) => @@ -170,9 +175,17 @@ describe("TechLog home discovery", () => { "파일 저장소 계약을 하나로 통합했습니다", "Authorization Code Flow에서 state와 nonce의 경계", "oauth2-proxy 뒤에서 토큰을 다시 검증할 것인가", - "Redis Adapter가 도메인 TTL 정책을 소유하지 않는 이유", - "TechLog Public·Studio 경계를 확정했습니다", ]); + /* + 종류 이름은 목록도 범례도 같은 표에서 가져온다. 목록만 영문 대문자로 나가던 동안 홈 한 + 화면에 종류 이름이 아홉 개 떠 있었고, 독자는 `CASE` 와 「검증 기록」이 같은 것이라는 + 단서를 어디서도 받지 못했다. + */ + expect( + [...new Set( + Array.from(latest.querySelectorAll(".latest-time > span"), (span) => span.textContent), + )].every((label) => /^[가-힣 ]+$/u.test(label ?? "")), + ).toBe(true); /* 종류별 입구. 예전에는 이 자리가 낱말 뜻풀이였고 이름이 `Case`·`OpenQuestion` 같은 저장소의 말이었다. 이름이 하는 일을 말하도록 바뀌었으므로 설명도 함께 바뀐다. diff --git a/tests/features/tech-log/public-document-screens.test.tsx b/tests/features/tech-log/public-document-screens.test.tsx index 66592c8..ba9ba05 100644 --- a/tests/features/tech-log/public-document-screens.test.tsx +++ b/tests/features/tech-log/public-document-screens.test.tsx @@ -245,7 +245,9 @@ describe("TechLog canonical Public documents", () => { } expect( - Array.from(container.querySelectorAll(".document-relations li a"), (link) => + Array.from( + container.querySelectorAll(".document-relations")[0]!.querySelectorAll("li a"), + (link) => link.getAttribute("href"), ), ).toEqual(relations); @@ -338,14 +340,44 @@ describe("TechLog canonical Public documents", () => { describe("TechLog topics and Public not-found routing", () => { it.each([ - ["jpa", "JPA", "3개의 관련 기록"], - ["authentication", "Authentication", "2개의 관련 기록"], - ["redis", "Redis", "1개의 관련 기록"], - ])("aggregates /topics/%s with its own name and count", async (slug, title, count) => { + ["jpa", "JPA"], + ["authentication", "Authentication"], + ["redis", "Redis"], + ])("aggregates /topics/%s under its own name", async (slug, title) => { await renderDocumentRoute("TECH_LOG_TOPIC", `/topics/${slug}`); expect(screen.getByRole("heading", { level: 1, name: title })).toBeVisible(); - expect(screen.getByText(count)).toBeVisible(); + expect(screen.getByRole("heading", { name: "먼저 읽을 것" })).toBeVisible(); + }); + + /* + 서버가 주는 대표 기록은 작성자가 주제마다 손으로 골라 두는 값이라 대부분 비어 있다. 비면 + 열린 질문만 남아, 아직 답이 없는 질문을 모아 두고 「먼저 읽을 것」이라 부르게 된다 — + 처음 온 사람에게 가장 나쁜 첫 화면이다. 그래서 기록에서 순서를 만든다: + 원리 → 확인한 기록 → 기준 → 아직 모르는 것. + */ + it("orders the first reads by kind and does not repeat them below", async () => { + const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa"); + + const firstReads = [ + ...(container.querySelectorAll(".document-relations")[0]?.querySelectorAll("li a") ?? []), + ].map((link) => ({ + label: link.querySelector("span")?.textContent, + href: link.getAttribute("href"), + })); + expect(firstReads.map((entry) => entry.label)).toEqual([ + "검증 기록", + "적용 기준", + "열린 질문", + ]); + + // 위에 오른 편은 아래 목록에서 빠진다 — 같은 편이 두 번 나오면 순서를 정해 준 뜻이 없다. + const rest = [...container.querySelectorAll(".public-record-list > li > a")].map((link) => + link.getAttribute("href"), + ); + for (const entry of firstReads) { + expect(rest).not.toContain(entry.href); + } }); /* @@ -357,7 +389,6 @@ describe("TechLog topics and Public not-found routing", () => { await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/kubernetes"); expect(screen.getByRole("heading", { level: 1, name: "Kubernetes" })).toBeVisible(); - expect(screen.getByText("1개의 관련 기록")).toBeVisible(); expect( screen.queryByRole("heading", { name: "페이지를 찾을 수 없습니다." }), ).not.toBeInTheDocument(); @@ -366,9 +397,11 @@ describe("TechLog topics and Public not-found routing", () => { it("keeps JPA topic records in canonical published order", async () => { const { container } = await renderDocumentRoute("TECH_LOG_TOPIC", "/topics/jpa"); + // 픽스처의 JPA 주제는 종류마다 한 편씩이라 셋 다 「먼저 읽을 것」으로 올라가고 아래는 빈다. expect( - Array.from(container.querySelectorAll(".public-record-list > li > a"), (link) => - link.getAttribute("href"), + Array.from( + container.querySelectorAll(".document-relations")[0]!.querySelectorAll("li a"), + (link) => link.getAttribute("href"), ), ).toEqual([ "/cases/collection-fetch-join-pagination",