Files
tech-log-frontend/tests/features/tech-log/navigation-derivation.test.ts
T
DongHyeonkaandClaude Opus 5 618a228eff fix: 관계의 묶음 이름과 작성자가 쓴 문장을 갈라 놓는다
관계 한 줄에 세 가지가 뭉쳐 있었다. 대상이 어떤 종류인지, 작성자가 왜 걸었는지,
대상이 무엇인지 — 셋 다 `reason` 한 칸을 지나느라 경로마다 다른 것이 같은 자리에
나왔다. 렌더 모델 경로에서는 작성자의 문장이 묶음 이름 자리에 눌려 한 줄짜리 라벨인
척했고, 공개 조회 경로에서는 묶음 이름이 그 자리를 차지하고 작성자의 문장은 아예
버려졌다. 「다음에 무엇을 읽을지」의 답이 그 문장인데 공개 화면에 한 번도 나오지 않았다.

이제 셋이 각자의 칸을 갖는다. `label` 은 대상의 종류, `note` 는 작성자가 쓴 문장,
`summary` 는 대상의 요약이다. 설명 자리에는 문장이 있으면 문장을, 없으면 요약을
보인다 — 요약은 대상을 설명하고 문장은 왜 지금 이것을 읽어야 하는지를 설명한다.

공개 주소로 종류를 되짚던 삼항 사슬도 표로 바꾼다. `/concepts/` 가 어디에도 없어서
개념으로 가는 관계가 전부 `PROJECT` 로 떨어지고 있었다 — 손으로 나열한 목록에 새
종류를 빠뜨리는 일이 이 저장소에서만 다섯 번째다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
2026-09-01 16:48:11 +09:00

62 lines
2.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { techLogNavigation } from "../../../src/features/tech-log/presentation/tech-log-navigation.ts";
import { TECH_LOG_ROUTE_REGISTRY } from "../../../src/features/tech-log/contracts/tech-log-route-contract.ts";
/**
* The headers used to repeat the route contract's navigation facts in their own
* literal arrays, so a renamed route or a reordered menu could be right in one
* place and stale in the other. These pin the derived result against the shape
* the headers rendered before the change, and against the contract itself.
*/
describe("TechLog navigation derivation", () => {
it("derives the public menu in contract order", () => {
expect(
techLogNavigation("PUBLIC").map((entry) => [entry.label, entry.path]),
).toEqual([
["탐색", "/explore"],
["프로젝트", "/projects"],
["프로필", "/profile"],
]);
});
it("derives the studio menu in contract order", () => {
expect(
techLogNavigation("STUDIO").map((entry) => [entry.label, entry.path]),
).toEqual([
["작업본", "/studio/documents"],
["게시 기록", "/studio/publications"],
["새 문서", "/studio/documents/new"],
["주제·프로젝트", "/studio/taxonomy"],
["릴리즈", "/studio/releases"],
]);
});
it("advertises exactly the routes the contract marks navigable", () => {
const navigable = Object.values(TECH_LOG_ROUTE_REGISTRY)
.filter((definition) => definition.navigationOrder !== null)
.map((definition) => definition.routeId)
.sort();
const derived = [
...techLogNavigation("PUBLIC"),
...techLogNavigation("STUDIO"),
]
.map((entry) => entry.routeId)
.sort();
expect(derived).toEqual(navigable);
});
it("keeps each shell's entries inside its own layout group", () => {
for (const group of ["PUBLIC", "STUDIO"] as const) {
for (const entry of techLogNavigation(group)) {
expect(
TECH_LOG_ROUTE_REGISTRY[
entry.routeId as keyof typeof TECH_LOG_ROUTE_REGISTRY
]?.layoutGroup,
entry.routeId,
).toBe(group);
}
}
});
});