Publishing needs a topic and nothing could create one. The backend now owns that surface; this is its consumer — the management contract vendored, a gateway over its nine operations, and one Studio screen that lists, creates, and deletes topics and projects. The screen adds no CSS. It reuses the classes the working-copy list already uses, so it inherits Studio's spacing, type, and colour rather than growing a second visual vocabulary beside them. Scope stops at list/create/delete: renaming, phase changes, and visibility are implemented in the backend and declared in the contract, but their screens are a separate design. Two real defects surfaced while making the public port async, and both would have shipped: The search page and the header search dialog shared a query key. With an empty query, `["tech-log","search",""]` was identical for both, so react-query handed one surface the other's cache — different shapes — and the page died reading a field that was not there. Keys now name the surface. The explore filter's selects are uncontrolled and read `defaultValue`, which React applies once. Their options arrive later now, so the first render had nothing to match and the value stayed empty: a topic in the URL no longer showed as selected. The form key includes whether the catalog has arrived, so it remounts with the options present. Controlled inputs would be the other answer, but this form submits to build a URL — the URL owns the value. The route brought its own bookkeeping: a build chunk, a manual accessibility evidence file, and the CI artifact baseline that counts them. The gate pins a digest of its own shape precisely so a new route cannot slip in without that count being reviewed. Test harnesses that render public screens now assemble the query providers and await the settled paint, because the screens they render became async.
62 lines
2.1 KiB
TypeScript
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"],
|
|
["변경 기록", "/releases"],
|
|
["프로필", "/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"],
|
|
]);
|
|
});
|
|
|
|
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);
|
|
}
|
|
}
|
|
});
|
|
});
|