Files
tech-log-frontend/tests/component/runtime-application.test.tsx
T
DongHyeonkaandClaude Opus 5 0b0c5cb42d feat: 홈이 길을 보여 주고, 활동이 사람 말로 적힌다
홈의 첫 문장은 글 쓰는 태도를 말했다 — "문제를 재현하고 검증해 정리합니다". 맞는
말이지만 처음 온 사람이 알아야 하는 것은 태도가 아니라 길이다. 이 사이트에서 기록은
한 편으로 끝나지 않고 프로젝트 안의 주제에 속하고 주제 안에서 서로 이어진다. 그 구조를
설명하는 문장보다 실제 사슬 하나가 빠르므로, 최근 기록이 가장 많이 모인 주제를 골라
프로젝트 → 주제 → 기록으로 편다. 예시를 코드에 적어 두지 않는다 — 그 기록을 지우는
순간 홈이 죽은 링크를 가리킨다.

프로젝트 활동은 종류 자리에 `CONCEPT_PUBLISHED` 를 그대로 찍고 있었다. 그것은
데이터베이스 제약(`project_activity_activity_type_check`)이 허용하는 값이지 방문자에게
할 말이 아니다 — 감사 로그처럼 읽히고, 정작 무슨 일이 있었는지는 알 수 없었다.

포트의 타입은 `"PUBLICATION" | "PROJECT UPDATE" | "QUESTION"` 셋으로 적혀 있었는데
서버는 그중 무엇도 보내지 않는다. 매퍼가 단언으로 통과시켜서 타입 검사도 이것을 잡지
못했다. 실제 값 열하나로 맞추고, `Record<ProjectActivityType, string>` 표로 사람이 읽는
문장을 만든다. 픽스처도 같은 값을 쓰게 했다 — 픽스처가 자기만의 말을 쓰던 동안 화면은
픽스처에서만 멀쩡했다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015c8cBFUaVr7KLVUx6ujz7D
2026-09-15 20:15:05 +09:00

99 lines
3.9 KiB
TypeScript

// @vitest-environment jsdom
import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { createRuntimeComposition } from "../../src/bootstrap/create-runtime-composition.ts";
import { RuntimeApplication } from "../../src/bootstrap/runtime-application.tsx";
const runtimeConfig = {
APP_ENV: "local",
API_BASE_URL: "http://localhost:8080",
REQUEST_TIMEOUT_MS: 10_000,
MAX_RETRY_ATTEMPTS: 2,
TELEMETRY_ENABLED: false,
AUTH_MODE: "demo",
CONFIG_SCHEMA_VERSION: "1",
API_CONTRACT_VERSION: "1",
RELEASE_MANIFEST_URL: "/release-manifest.json",
BUILD_ID: "local-build",
RELEASE_ID: "local-release",
};
const releaseManifest = {
schemaVersion: 1,
appVersion: "0.1.0",
buildId: "local-build",
commitSha: "local",
configSchemaVersion: "1",
apiContractVersion: "1",
assetManifestHash: "test-hash",
releaseId: "local-release",
builtAt: "2026-07-26T00:00:00.000Z",
routeChunks: {
"route-tech-log-home": "assets/tech-log-home.js",
"route-tech-log-explore": "assets/tech-log-explore.js",
"route-tech-log-explore-kind": "assets/tech-log-explore-kind.js",
"route-tech-log-case": "assets/tech-log-case.js",
"route-tech-log-reference": "assets/tech-log-reference.js",
"route-tech-log-question": "assets/tech-log-question.js",
"route-tech-log-topic": "assets/tech-log-topic.js",
"route-tech-log-projects": "assets/tech-log-projects.js",
"route-tech-log-project": "assets/tech-log-project.js",
"route-tech-log-project-records": "assets/tech-log-project-records.js",
"route-tech-log-project-decisions": "assets/tech-log-project-decisions.js",
"route-tech-log-project-activity": "assets/tech-log-project-activity.js",
"route-tech-log-releases": "assets/tech-log-releases.js",
"route-tech-log-release": "assets/tech-log-release.js",
"route-tech-log-profile": "assets/tech-log-profile.js",
"route-tech-log-search": "assets/tech-log-search.js",
"route-tech-log-studio-home": "assets/tech-log-studio-home.js",
"route-tech-log-studio-documents": "assets/tech-log-studio-documents.js",
"route-tech-log-studio-document-new": "assets/tech-log-studio-document-new.js",
"route-tech-log-studio-document-edit": "assets/tech-log-studio-document-edit.js",
"route-tech-log-studio-document-validation": "assets/tech-log-studio-document-validation.js",
"route-tech-log-studio-document-preview": "assets/tech-log-studio-document-preview.js",
"route-tech-log-studio-document-publish": "assets/tech-log-studio-document-publish.js",
"route-tech-log-studio-publications": "assets/tech-log-studio-publications.js",
"route-tech-log-studio-publication-preview": "assets/tech-log-studio-publication-preview.js",
"route-tech-log-studio-not-found": "assets/tech-log-studio-not-found.js",
"route-not-found": "assets/not-found.js",
},
};
describe("production runtime application tree", () => {
it("connects validated config and release through composition and ApplicationProvider", async () => {
const fetcher = vi.fn(async (input) => {
const url =
typeof input === "string"
? input
: input instanceof URL
? input.href
: input.url;
return Response.json(
url.includes("release-manifest") ? releaseManifest : runtimeConfig,
);
});
const composition = await createRuntimeComposition({
fetcher,
host: {},
});
window.history.pushState({}, "", "/");
render(<RuntimeApplication composition={composition} />);
expect(
await screen.findByRole("heading", {
name: "TechLog",
}),
).toBeVisible();
expect(
await screen.findAllByText(
"문제를 한 편의 글로 끝내지 않고, 질문에서 검증과 결정까지 이어서 기록합니다.",
),
).toHaveLength(2);
expect(fetcher).toHaveBeenCalledTimes(2);
expect(composition).not.toHaveProperty("ports");
});
});