홈에 「맥락 흐름」(기록의 사슬)·「지금 집중하는 것」(작업 상태)·「주제별 흐름」(주제 내부 구조)이 연달아 섰다. 데이터로는 서로 다른 계층이지만 읽는 사람에게는 셋 다 "그래서 뭘 읽으라는 거지" 에 답하는 같은 종류의 안내였고, 같은 말을 세 방식으로 반복하는 화면이 됐다. 계층마다 제 자리를 준다. - 홈: 지금 무엇을 하고 있는가. 탭 셋을 한 번에 펴고(`HomeNow`), 맥락 흐름과 주제 비교를 내리고, 들어갈 입구로 프로젝트 목록을 세운다. 고를 것이 없어졌으므로 주소의 `focus` 도 계약에서 내린다. - 프로젝트: 어떤 주제 순서로 파고들었는가. 기록을 펼치던 조사 지도를 주제까지만 그리는 흐름(`ProjectPath`)으로 바꾼다. 한 줄 설명은 주제 목록에서 찾아 붙인다. - 주제: 어떤 순서로 생각했는가. 원리 → 확인 → 기준을 흐름으로 세우고(`TopicReasoningPath`), 남은 기록은 「정리해 둔 것」, 답하지 못한 질문은 「아직 답하지 못한 것」이 받는다. 축 비교표는 길 안내가 아니라 이 주제가 세운 모델이므로 이름을 그렇게 고친다. 기록 화면은 그대로다 — 위치와 앞뒤만 보이고 새 맥락 경로를 다시 그리지 않는다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
257 lines
12 KiB
TypeScript
257 lines
12 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
TECH_LOG_ROUTE_REGISTRY,
|
|
TECH_LOG_ROUTE_RUNTIME_CONTRACT,
|
|
} from "../../../src/features/tech-log/contracts/tech-log-route-contract.ts";
|
|
import { TECH_LOG_MESSAGE_CATALOGS } from "../../../src/features/tech-log/contracts/tech-log-message-catalog.ts";
|
|
import { TECH_LOG_ROUTE_CODECS } from "../../../src/features/tech-log/presentation/tech-log-route-codecs.ts";
|
|
import { ROUTE_REGISTRY } from "../../../src/features/installed-feature-contracts.ts";
|
|
import { ROUTE_RUNTIME } from "../../../src/features/installed-feature-runtimes.tsx";
|
|
import { buildRouteUrlFromContract } from "../../../src/presentation/routes/route-codecs.ts";
|
|
import { PLATFORM_ROUTE_CODECS } from "../../../src/presentation/routes/platform-route-codecs.ts";
|
|
|
|
const expectedRoutes = [
|
|
["TECH_LOG_HOME", "/", "PUBLIC", null, "TechLogHomeSearch"],
|
|
["TECH_LOG_EXPLORE", "/explore", "PUBLIC", null, "TechLogExploreSearch"],
|
|
["TECH_LOG_EXPLORE_KIND", "/explore/:kind", "PUBLIC", "TechLogExploreKindParams", "TechLogExploreKindSearch"],
|
|
["TECH_LOG_CASE", "/cases/:slug", "PUBLIC", "TechLogSlugParams", "TechLogCaseStateSearch"],
|
|
["TECH_LOG_REFERENCE", "/references/:slug", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_CONCEPT", "/concepts/:slug", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_SETUP", "/setups/:slug", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_QUESTION", "/questions/:slug", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_TOPICS", "/topics", "PUBLIC", null, null],
|
|
["TECH_LOG_TOPIC", "/topics/:slug", "PUBLIC", "TechLogSlugParams", null],
|
|
[
|
|
"TECH_LOG_TOPIC_VARIANT",
|
|
"/topics/:slug/:variant",
|
|
"PUBLIC",
|
|
"TechLogTopicVariantParams",
|
|
null,
|
|
],
|
|
["TECH_LOG_PROJECTS", "/projects", "PUBLIC", null, null],
|
|
["TECH_LOG_PROJECT", "/projects/:slug", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_PROJECT_RECORDS", "/projects/:slug/records", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_PROJECT_DECISIONS", "/projects/:slug/decisions", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_PROJECT_ACTIVITY", "/projects/:slug/activity", "PUBLIC", "TechLogSlugParams", null],
|
|
["TECH_LOG_RELEASES", "/releases", "PUBLIC", null, null],
|
|
["TECH_LOG_RELEASE", "/releases/:version", "PUBLIC", "TechLogVersionParams", null],
|
|
["TECH_LOG_PROFILE", "/profile", "PUBLIC", null, null],
|
|
["TECH_LOG_SEARCH", "/search", "PUBLIC", null, "TechLogSearchQuery"],
|
|
["TECH_LOG_STUDIO_HOME", "/studio", "STUDIO", null, null],
|
|
["TECH_LOG_STUDIO_DOCUMENTS", "/studio/documents", "STUDIO", null, "TechLogStudioDocumentsSearch"],
|
|
["TECH_LOG_STUDIO_DOCUMENT_NEW", "/studio/documents/new", "STUDIO", null, null],
|
|
["TECH_LOG_STUDIO_DOCUMENT_EDIT", "/studio/documents/:id/edit", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_DOCUMENT_VALIDATION", "/studio/documents/:id/validation", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_DOCUMENT_PREVIEW", "/studio/documents/:id/preview", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_DOCUMENT_PUBLISH", "/studio/documents/:id/publish", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_PUBLICATIONS", "/studio/publications", "STUDIO", null, "TechLogStudioPublicationsSearch"],
|
|
["TECH_LOG_STUDIO_PUBLICATION_PREVIEW", "/studio/publications/:publicationEventId/preview", "STUDIO", "TechLogPublicationEventIdParams", null],
|
|
["TECH_LOG_STUDIO_ASSETS", "/studio/assets", "STUDIO", null, null],
|
|
["TECH_LOG_STUDIO_TAXONOMY", "/studio/taxonomy", "STUDIO", null, null],
|
|
["TECH_LOG_STUDIO_PROJECT_EDIT", "/studio/projects/:id", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_TOPIC_EDIT", "/studio/topics/:id", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_RELEASES", "/studio/releases", "STUDIO", null, null],
|
|
["TECH_LOG_STUDIO_RELEASE_EDIT", "/studio/releases/:id", "STUDIO", "TechLogDocumentIdParams", null],
|
|
["TECH_LOG_STUDIO_NOT_FOUND", "/studio/*", "STUDIO", "TechLogStudioSplat", null],
|
|
["NOT_FOUND", "*", "PUBLIC", "NotFoundSplat", null],
|
|
] as const;
|
|
|
|
const expectedTitles = {
|
|
TECH_LOG_HOME: "TechLog",
|
|
TECH_LOG_EXPLORE: "탐색",
|
|
TECH_LOG_EXPLORE_KIND: "유형별 탐색",
|
|
TECH_LOG_CASE: "Case",
|
|
TECH_LOG_CONCEPT: "개념",
|
|
TECH_LOG_SETUP: "환경 구성",
|
|
TECH_LOG_REFERENCE: "Reference",
|
|
TECH_LOG_QUESTION: "Open Question",
|
|
TECH_LOG_TOPICS: "주제",
|
|
TECH_LOG_TOPIC: "Topic",
|
|
TECH_LOG_TOPIC_VARIANT: "Topic",
|
|
TECH_LOG_PROJECTS: "프로젝트",
|
|
TECH_LOG_PROJECT: "프로젝트",
|
|
TECH_LOG_PROJECT_RECORDS: "프로젝트 기록",
|
|
TECH_LOG_PROJECT_DECISIONS: "프로젝트 결정",
|
|
TECH_LOG_PROJECT_ACTIVITY: "프로젝트 활동",
|
|
TECH_LOG_RELEASES: "변경 기록",
|
|
TECH_LOG_RELEASE: "변경 기록",
|
|
TECH_LOG_PROFILE: "프로필",
|
|
TECH_LOG_SEARCH: "검색",
|
|
TECH_LOG_STUDIO_HOME: "TechLog Studio",
|
|
TECH_LOG_STUDIO_DOCUMENTS: "작업본",
|
|
TECH_LOG_STUDIO_DOCUMENT_NEW: "새 문서",
|
|
TECH_LOG_STUDIO_DOCUMENT_EDIT: "문서 편집",
|
|
TECH_LOG_STUDIO_DOCUMENT_VALIDATION: "문서 검증",
|
|
TECH_LOG_STUDIO_DOCUMENT_PREVIEW: "Public Preview",
|
|
TECH_LOG_STUDIO_DOCUMENT_PUBLISH: "게시",
|
|
TECH_LOG_STUDIO_PUBLICATIONS: "게시 기록",
|
|
TECH_LOG_STUDIO_PUBLICATION_PREVIEW: "게시 Snapshot",
|
|
TECH_LOG_STUDIO_ASSETS: "Asset",
|
|
TECH_LOG_STUDIO_TAXONOMY: "주제와 프로젝트",
|
|
TECH_LOG_STUDIO_PROJECT_EDIT: "프로젝트 편집",
|
|
TECH_LOG_STUDIO_TOPIC_EDIT: "주제 편집",
|
|
TECH_LOG_STUDIO_RELEASES: "릴리즈",
|
|
TECH_LOG_STUDIO_RELEASE_EDIT: "릴리즈 편집",
|
|
TECH_LOG_STUDIO_NOT_FOUND: "Studio 화면을 찾을 수 없습니다",
|
|
NOT_FOUND: "페이지를 찾을 수 없습니다.",
|
|
} as const;
|
|
|
|
describe("TechLog route boundary contract", () => {
|
|
it("freezes the standalone 35-route inventory before runtime installation", () => {
|
|
expect(
|
|
Object.values(TECH_LOG_ROUTE_REGISTRY).map((definition) => [
|
|
definition.routeId,
|
|
definition.path,
|
|
definition.layoutGroup,
|
|
definition.paramsSchema,
|
|
definition.searchSchema,
|
|
]),
|
|
).toEqual(expectedRoutes);
|
|
|
|
expect(
|
|
Object.values(TECH_LOG_ROUTE_REGISTRY).map((definition) => [
|
|
definition.routeId,
|
|
definition.access,
|
|
definition.chunkId,
|
|
]),
|
|
).toEqual(
|
|
// Studio is the authenticated surface, Public is not. Derived here from
|
|
// the frozen inventory's own layoutGroup column rather than restated per
|
|
// route, so a Studio route added without a gate fails this table too —
|
|
// every TechLog route used to be registered "public", which made the
|
|
// router's access decision a no-op for Studio.
|
|
expectedRoutes.map(([routeId, , layoutGroup]) => [
|
|
routeId,
|
|
layoutGroup === "STUDIO" ? "session-required" : "public",
|
|
routeId === "NOT_FOUND"
|
|
? "route-not-found"
|
|
: `route-${routeId.toLowerCase().replaceAll("_", "-")}`,
|
|
]),
|
|
);
|
|
});
|
|
|
|
it("keeps runtime module and codec bindings aligned with every dormant route", () => {
|
|
expect(Object.keys(TECH_LOG_ROUTE_RUNTIME_CONTRACT)).toEqual(
|
|
expectedRoutes.map(([routeId]) => routeId),
|
|
);
|
|
for (const [routeId, , , paramsSchema, searchSchema] of expectedRoutes) {
|
|
expect(TECH_LOG_ROUTE_RUNTIME_CONTRACT[routeId]).toEqual({
|
|
routeId,
|
|
moduleId:
|
|
routeId === "NOT_FOUND"
|
|
? "route-not-found"
|
|
: `route-${routeId.toLowerCase().replaceAll("_", "-")}`,
|
|
paramsCodec: paramsSchema ?? "none",
|
|
searchCodec: searchSchema ?? "none",
|
|
});
|
|
}
|
|
});
|
|
|
|
it("preserves source navigation labels and the complete route message catalog", () => {
|
|
expect(
|
|
Object.values(TECH_LOG_ROUTE_REGISTRY)
|
|
.filter((definition) => definition.navigationLabel !== null)
|
|
.map(({ routeId, layoutGroup, navigationLabel, navigationOrder }) => [
|
|
routeId,
|
|
layoutGroup,
|
|
navigationLabel,
|
|
navigationOrder,
|
|
]),
|
|
).toEqual([
|
|
["TECH_LOG_EXPLORE", "PUBLIC", "탐색", 10],
|
|
["TECH_LOG_TOPICS", "PUBLIC", "주제", 15],
|
|
["TECH_LOG_PROJECTS", "PUBLIC", "프로젝트", 20],
|
|
["TECH_LOG_PROFILE", "PUBLIC", "프로필", 40],
|
|
["TECH_LOG_STUDIO_DOCUMENTS", "STUDIO", "작업본", 10],
|
|
["TECH_LOG_STUDIO_DOCUMENT_NEW", "STUDIO", "새 문서", 30],
|
|
["TECH_LOG_STUDIO_PUBLICATIONS", "STUDIO", "게시 기록", 20],
|
|
["TECH_LOG_STUDIO_ASSETS", "STUDIO", "Asset", 45],
|
|
["TECH_LOG_STUDIO_TAXONOMY", "STUDIO", "주제·프로젝트", 40],
|
|
["TECH_LOG_STUDIO_RELEASES", "STUDIO", "릴리즈", 50],
|
|
]);
|
|
|
|
for (const locale of ["ko-KR", "en-US"] as const) {
|
|
const catalog: Readonly<Record<string, string>> =
|
|
TECH_LOG_MESSAGE_CATALOGS[locale];
|
|
expect(Object.keys(catalog)).toHaveLength(74);
|
|
for (const [routeId, title] of Object.entries(expectedTitles)) {
|
|
expect(catalog[`route.${routeId}.title`]).toBe(title);
|
|
expect(catalog[`route.${routeId}.navigation`]).toBe(title);
|
|
}
|
|
}
|
|
});
|
|
|
|
it("normalizes source search semantics and rejects empty path parameters", () => {
|
|
expect(
|
|
TECH_LOG_ROUTE_CODECS.TechLogExploreSearch.parse({
|
|
type: ["CASE", "REFERENCE"],
|
|
topic: [" JPA ", "Redis"],
|
|
project: " tech-log ",
|
|
unknown: "drop-me",
|
|
}),
|
|
).toEqual({ type: "CASE", topic: "JPA", project: "tech-log" });
|
|
expect(
|
|
TECH_LOG_ROUTE_CODECS.TechLogHomeSearch.parse({
|
|
// 탭이 사라지면서 `focus` 도 계약에서 내렸다. 남아 있으면 조용히 버려진다.
|
|
focus: ["architecture", "delivery"],
|
|
state: ["latest-empty", "site-error"],
|
|
}),
|
|
).toEqual({ state: "latest-empty" });
|
|
expect(
|
|
TECH_LOG_ROUTE_CODECS.TechLogSearchQuery.parse({ q: [" gateway ", "ignored"] }),
|
|
).toEqual({ q: "gateway" });
|
|
expect(
|
|
TECH_LOG_ROUTE_CODECS.TechLogSlugParams.safeParse({ slug: "" }).success,
|
|
).toBe(false);
|
|
expect(
|
|
TECH_LOG_ROUTE_CODECS.TechLogDocumentIdParams.safeParse({ id: "" }).success,
|
|
).toBe(false);
|
|
});
|
|
|
|
it("builds canonical TechLog URLs with non-empty string codecs", () => {
|
|
const route = TECH_LOG_ROUTE_REGISTRY.TECH_LOG_STUDIO_PUBLICATION_PREVIEW;
|
|
const runtime =
|
|
TECH_LOG_ROUTE_RUNTIME_CONTRACT.TECH_LOG_STUDIO_PUBLICATION_PREVIEW;
|
|
expect(
|
|
buildRouteUrlFromContract(route, runtime, {
|
|
...PLATFORM_ROUTE_CODECS,
|
|
...TECH_LOG_ROUTE_CODECS,
|
|
}, {
|
|
params: { publicationEventId: "event/01" },
|
|
}),
|
|
).toBe("/studio/publications/event%2F01/preview");
|
|
|
|
expect(() =>
|
|
buildRouteUrlFromContract(route, runtime, {
|
|
...PLATFORM_ROUTE_CODECS,
|
|
...TECH_LOG_ROUTE_CODECS,
|
|
}, {
|
|
params: { publicationEventId: "" },
|
|
}),
|
|
).toThrow();
|
|
});
|
|
|
|
/*
|
|
Asset 화면은 오래 내비게이션 밖에 있었다. 화면 설명은 "사용하지 않는 Asset 을 정리합니다"
|
|
인데 거기 갈 방법이 URL 직접 입력뿐이었다 — 정리하라고 만든 화면에 정리하러 갈 길이 없었다.
|
|
*/
|
|
it("registers the studio asset library in primary navigation", () => {
|
|
const route = TECH_LOG_ROUTE_REGISTRY.TECH_LOG_STUDIO_ASSETS;
|
|
|
|
expect(route).toBeTruthy();
|
|
expect(route.path).toBe("/studio/assets");
|
|
expect(route.layoutGroup).toBe("STUDIO");
|
|
expect(route.navigationLabel).toBe("Asset");
|
|
expect(route.navigationOrder).toBe(45);
|
|
});
|
|
|
|
it("atomically installs the complete TechLog route and runtime inventories", () => {
|
|
expect(Object.keys(ROUTE_REGISTRY)).toEqual(
|
|
expectedRoutes.map(([routeId]) => routeId),
|
|
);
|
|
expect(Object.keys(ROUTE_RUNTIME)).toEqual(Object.keys(ROUTE_REGISTRY));
|
|
expect(ROUTE_REGISTRY).toEqual(TECH_LOG_ROUTE_REGISTRY);
|
|
});
|
|
});
|