feat(features): add bind-dev-seed binders for auth/marketing-pages/navigation/media
Mirrors the canonical blog pattern landed earlier on this branch. Per feature: - src/__seeds__/dev.ts — lazy buildDev<Entities>() function using the feature's existing factory for sensible defaults - src/di/bind-dev-seed.ts — bindDevSeed<Feature>() async function that rebinds the repo symbol(s) to a populated MockXRepository via .toConstantValue - src/di/bind-dev-seed.test.ts — 3+ tests per feature (populates, reachable by id/slug, idempotent) - package.json — adds ./di/bind-dev-seed subpath export Tests + use cases continue to construct mocks directly; the seed never runs from a *.test.ts path. App boot wiring (USE_DEV_SEED env branch) follows in a separate commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
packages/media/src/__seeds__/dev.ts
Normal file
38
packages/media/src/__seeds__/dev.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { mediaFactory } from "../__factories__/media.factory.js";
|
||||
import type { Media } from "../entities/models/media.js";
|
||||
|
||||
/**
|
||||
* Realistic media seed for dev mode + storybook stories.
|
||||
*
|
||||
* Built from `mediaFactory` so factory defaults take care of boring fields
|
||||
* and we only override what makes the data look like a real media library.
|
||||
*
|
||||
* Lazily produced so importing this module is side-effect-free — the
|
||||
* factory's sequence counter only advances when a binder calls
|
||||
* `buildDevMedia()`.
|
||||
*/
|
||||
export function buildDevMedia(): Media[] {
|
||||
return [
|
||||
mediaFactory.build({
|
||||
id: "placeholder-1",
|
||||
alt: "Hero background image",
|
||||
url: "/dev/placeholder-1.jpg",
|
||||
filename: "placeholder-1.jpg",
|
||||
mimeType: "image/jpeg",
|
||||
}),
|
||||
mediaFactory.build({
|
||||
id: "placeholder-2",
|
||||
alt: "Team photo",
|
||||
url: "/dev/placeholder-2.jpg",
|
||||
filename: "placeholder-2.jpg",
|
||||
mimeType: "image/jpeg",
|
||||
}),
|
||||
mediaFactory.build({
|
||||
id: "placeholder-3",
|
||||
alt: "Product screenshot",
|
||||
url: "/dev/placeholder-3.png",
|
||||
filename: "placeholder-3.png",
|
||||
mimeType: "image/png",
|
||||
}),
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user