Files
clean-architecture-frontend…/tests/unit/feature-tracked-files.test.ts
T
DongHyeonka af10cae9a6 docs(architecture): 현재 계약 문서와 매뉴얼의 영어 부분을 한국어로 옮긴다
문제: docs/architecture의 현재 계약 문서 가운데 scale-architecture.md,
starter-experience.md, capability-consumer-experience.md,
contract-ownership.md, static-delivery.md, review-evidence.md는 본문이
영어이고, backend-api-and-server-state-contract.md와
optional-adapter-recipes.md에는 영어 문단이 남아 있다.

고른 방법: 뜻을 바꾸지 않고 옮긴다. 백틱 안, 링크 대상, 절 번호(코드
주석이 `scale-architecture.md §N`으로 인용한다), 표 구조, 코드 블록은
그대로 둔다. 문서를 읽는 테스트와 절 이름을 인용한 곳을 같은 변경에서
고친다.
- tests/unit/feature-tracked-files.test.ts: starter-experience.md 표를
  자르는 시작·끝 문장과 표 행마다 찾는 낱말(`병합 충돌`)
- 「Ownership declarations」「Adding a feature」를 인용한 주석
  (create-feature.ts, generate-product-feature-index.ts, app-module.ts)과
  docs/manual의 절 이름 인용
- optional-adapter-recipes.md의 recipe 개수 복사를 카탈로그를 가리키게
  바꾼다(number 검사)

위험: create-feature.ts 417줄은 생성하는 context-module.ts의 JSDoc이라
새로 만드는 기능의 주석 글자가 바뀐다. 그 글자를 비교하는 테스트는 없다.
review-evidence.md는 산문만 옮겼고 해시·점수 칸은 그대로다.

검증: 백틱 span·링크 대상·코드 블록·번호 제목을 옮기기 전과 python으로
비교해 같다. 문서 검사의 language 줄이 이 문서들에서 0이 되어 예외
목록에서 지웠다.
2026-11-08 21:57:47 +09:00

57 lines
2.4 KiB
TypeScript

import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { FEATURE_TRACKED_FILE_REWRITES } from "../../scripts/create-feature.ts";
/**
* 1105/16-01. Adding a feature changes two tracked template files: the dev
* server's manifest (`create:feature` rewrites it) and the initial
* JavaScript record (rewritten by command). The 03
* manual's section A said the command writes two files outside the feature
* folder and named neither, the canonical table in starter-experience.md
* had neither, and nothing said what to do when two feature branches change
* the same `setDigest` line. The documents name each file with the command
* that rewrites it, which is also how a merge conflict on it is resolved.
*
* 1106/12-01. Every test here reads a document, so the removal drills that
* copy no documents leave this file out (REMOVAL_FIXTURE_DOCUMENT_TESTS in
* scripts/lib/removal-fixture.ts). The generator's own list is checked in
* tests/unit/feature-tracked-file-rewrites.test.ts, which every drill runs.
*/
function between(text: string, start: string, end: string): string {
const from = text.indexOf(start);
const to = text.indexOf(end, from + start.length);
if (from < 0 || to < 0) throw new Error(`no section from "${start}" to "${end}"`);
return text.slice(from, to);
}
describe("tracked files a feature changes (1105/16-01)", () => {
it("names each file and its rewrite command in the 03 manual's section A", async () => {
const section = between(
await readFile("docs/manual/03-outside-feature-folder.md", "utf8"),
"## A. 생성 명령이 만든다",
"## B. ",
);
for (const file of FEATURE_TRACKED_FILE_REWRITES) {
expect(section, file.path).toContain(file.path);
expect(section, file.path).toContain(file.command);
}
expect(section).toMatch(/충돌/u);
});
it("names each file and its rewrite command in the canonical table", async () => {
const table = between(
await readFile("docs/architecture/starter-experience.md", "utf8"),
"feature 디렉터리 밖 파일은 아래 표에 있다.",
"중앙 카탈로그",
);
for (const file of FEATURE_TRACKED_FILE_REWRITES) {
const row = table.split("\n").find((line) => line.startsWith("|") && line.includes(file.path));
expect(row, file.path).toBeDefined();
expect(row, file.path).toContain(file.command);
expect(row, file.path).toMatch(/병합 충돌/u);
}
});
});