Files
clean-architecture-frontend…/tests/fixtures/indexeddb-consumer/domain/local-draft.ts
T
DongHyeonka b72cd7d4a7 test(fixtures): local-draft 샘플을 IndexedDB 소비자 fixture로 옮긴다
src/features/local-draft-feature는 기능이 아니라 IndexedDB recipe의
소비자다. 시험 5개와 recipe가 쓰고, 그래서 생성기에 NOT_A_FEATURE
예외가 있었다(S4 3.1절 S-3).

코드를 tests/fixtures/indexeddb-consumer/로 옮기고 import만 고쳤다.
NOT_A_FEATURE 표식은 이 폴더만 썼고 다운스트림 둘에도 없어 생성기에서
지웠다. 선언 없는 폴더는 밖으로 옮기라는 메시지로 실패한다. 매뉴얼
오류표, README, starter-experience, capability-consumer-experience,
patterns를 고쳤다.

위험: fixture는 기능 폴더 밖이라 기능 계층 규칙(dependency-cruiser)이
걸리지 않는다. recipe가 tests/ 아래 파일을 type import한다.

검증(desktop): test:contract, test:recipes, test:browser-capabilities,
test:unit 통과.
2026-11-08 13:51:55 +09:00

32 lines
1.1 KiB
TypeScript

export type LocalDraft = Readonly<{
/**
* 09-08. One id per draft, never reused after the draft is removed. The
* repository deletes without a tombstone and a recreated record starts again
* at revision 1, so a tab still holding revision N of the removed draft
* could compare-and-swap over a new draft that reused its id (the capability
* port's revision contract says so: IndexedDbWriteReceipt.revision in
* src/application/ports/browser-file-storage/indexeddb-port.ts). A fresh id
* per draft (for example crypto.randomUUID()) makes that stale save a
* CONFLICT; a product that must reuse ids needs tombstones instead.
*/
draftId: string;
title: string;
body: string;
}>;
export function createLocalDraft(values: LocalDraft): LocalDraft {
const draftId = values.draftId.trim();
const title = values.title.trim();
if (!draftId || !title) {
throw new TypeError("Local draft requires draftId and title");
}
if (title.length > 160 || values.body.length > 100_000) {
throw new TypeError("Local draft exceeds bounded field limits");
}
return Object.freeze({
draftId,
title,
body: values.body,
});
}