주제로 가는 길이 기록의 breadcrumb 과 탐색의 묶음 제목뿐이었다. 주제가 이 기록의 뼈대인데 그 목록을 정면으로 보여 주는 자리가 없었고, 홈이 한 주제만 펼치던 동안 나머지는 최근 기록에 우연히 걸릴 때만 보였다. 목록의 각 줄은 이름·논지·축·기록 수를 싣는다. 이름은 무엇에 대한 것인지만 말하므로, 들어갈지 말지를 정하려면 그 주제가 무엇에 답하는지가 함께 있어야 한다. 그래서 계약의 `TopicListItem` 에 논지와 축을 더한다 — 그동안 이름과 개수뿐이었다. 홈의 「다른 주제」 줄은 목록으로 가는 한 줄로 줄인다. 주제가 늘면 옆으로 길어지던 자리다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
63 lines
2.2 KiB
TypeScript
63 lines
2.2 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"],
|
|
["주제", "/topics"],
|
|
["프로젝트", "/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);
|
|
}
|
|
}
|
|
});
|
|
});
|