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 통과.
This commit is contained in:
@@ -145,7 +145,7 @@ describe("app-scoped selection from ownership declarations", () => {
|
||||
await expect(generateAppIndexes(overContexts, "a")).rejects.toThrow(/App a context cardinality 2 exceeds budget 1/);
|
||||
});
|
||||
|
||||
it("refuses a feature directory without a declaration or NOT_A_FEATURE marker (09-07)", async () => {
|
||||
it("refuses a feature directory without a declaration (09-07)", async () => {
|
||||
const files = {
|
||||
"src/apps/a/app-module.ts": app("a"),
|
||||
"src/contexts/c/context-module.ts": context("c", "a"),
|
||||
@@ -154,40 +154,20 @@ describe("app-scoped selection from ownership declarations", () => {
|
||||
"src/features/typo/feature-modul.ts": feature("typo", "c"),
|
||||
};
|
||||
await expect(generateAppIndexes(await repo(files), "a")).rejects.toThrow(
|
||||
/src\/features\/typo has no feature-module\.ts/u,
|
||||
);
|
||||
const marked = await repo({
|
||||
...files,
|
||||
"src/features/typo/NOT_A_FEATURE": "Composed only by tests.\n",
|
||||
});
|
||||
const selected = await generateAppIndexes(marked, "a");
|
||||
expect(selected.entries.map((entry) => entry.id)).toEqual(["f"]);
|
||||
});
|
||||
|
||||
it("no longer accepts the old NOT_INSTALLED marker name (1103/09-09)", async () => {
|
||||
// The word is the runtime state "declared but not selected"; a marker
|
||||
// under that name is read as a missing declaration, naming the new one.
|
||||
const root = await repo({
|
||||
"src/apps/a/app-module.ts": app("a"),
|
||||
"src/contexts/c/context-module.ts": context("c", "a"),
|
||||
"src/features/sample/NOT_INSTALLED": "Composed only by tests.\n",
|
||||
});
|
||||
await expect(generateAppIndexes(root, "a")).rejects.toThrow(
|
||||
/src\/features\/sample has no feature-module\.ts; add one or mark the directory with NOT_A_FEATURE/u,
|
||||
/src\/features\/typo has no feature-module\.ts; add one, or keep code that is no feature outside src\/features/u,
|
||||
);
|
||||
});
|
||||
|
||||
it("refuses a marked directory that also declares a feature (1103/09-09)", async () => {
|
||||
// Graduating a sample means deleting the marker; keeping both used to
|
||||
// install the feature silently while the marker said it was none.
|
||||
it("reads a marker file as a missing declaration", async () => {
|
||||
// The local-draft sample used to skip the check with a NOT_A_FEATURE
|
||||
// file; it is a test fixture now and the marker is gone.
|
||||
const root = await repo({
|
||||
"src/apps/a/app-module.ts": app("a"),
|
||||
"src/contexts/c/context-module.ts": context("c", "a"),
|
||||
"src/features/f/feature-module.ts": feature("f", "c"),
|
||||
"src/features/f/NOT_A_FEATURE": "Composed only by tests.\n",
|
||||
"src/features/sample/NOT_A_FEATURE": "Composed only by tests.\n",
|
||||
});
|
||||
await expect(generateAppIndexes(root, "a")).rejects.toThrow(
|
||||
/src\/features\/f has both feature-module\.ts and NOT_A_FEATURE; delete NOT_A_FEATURE to install it, or feature-module\.ts to keep it out/u,
|
||||
/src\/features\/sample has no feature-module\.ts/u,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user