Media is now a complete vertical-feature package mirroring auth/blog structure: entities (models + errors), application (repositories + use-cases), infrastructure (real Payload-backed + mock siblings), interface-adapters (per-use-case controllers), DI (symbols + module + container + bind-production), integrations/api (mediaRouter), factory, contract suite, and feature integration tests. Wired into: - packages/core-api/src/root.ts (added `media: mediaRouter`) - apps/web-next/src/server/bind-production.ts (calls bindProductionMedia) - tsconfig.base.json (added @repo/media/api and ./di/bind-production aliases) 56 new tests in @repo/media (13 test files); core-api router test updated to assert media. procedures. All 26 turbo tasks green. Refactor log: §2, §4.1, §4.2, §5.1, §6.1 Spec: §6.5 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
import { mediaContainer } from "@/di/container";
|
|
import { MEDIA_SYMBOLS } from "@/di/symbols";
|
|
import { MediaModule } from "@/di/module";
|
|
import { MockMediaRepository } from "@/infrastructure/repositories/media.repository.mock";
|
|
import type { IMediaRepository } from "@/application/repositories/media.repository.interface";
|
|
|
|
describe("mediaContainer", () => {
|
|
beforeEach(() => {
|
|
mediaContainer.unbindAll();
|
|
mediaContainer.load(MediaModule);
|
|
});
|
|
|
|
afterEach(() => {
|
|
mediaContainer.unbindAll();
|
|
});
|
|
|
|
it("resolves IMediaRepository to MockMediaRepository by default binding", () => {
|
|
const repo = mediaContainer.get<IMediaRepository>(MEDIA_SYMBOLS.IMediaRepository);
|
|
expect(repo).toBeInstanceOf(MockMediaRepository);
|
|
});
|
|
|
|
it("resolves IGetMediaController as a function", () => {
|
|
const ctrl = mediaContainer.get(MEDIA_SYMBOLS.IGetMediaController);
|
|
expect(typeof ctrl).toBe("function");
|
|
});
|
|
|
|
it("resolves IListMediaController as a function", () => {
|
|
const ctrl = mediaContainer.get(MEDIA_SYMBOLS.IListMediaController);
|
|
expect(typeof ctrl).toBe("function");
|
|
});
|
|
|
|
it("resolves IDeleteMediaController as a function", () => {
|
|
const ctrl = mediaContainer.get(MEDIA_SYMBOLS.IDeleteMediaController);
|
|
expect(typeof ctrl).toBe("function");
|
|
});
|
|
|
|
it("resolves IGetMediaUseCase as a function", () => {
|
|
const uc = mediaContainer.get(MEDIA_SYMBOLS.IGetMediaUseCase);
|
|
expect(typeof uc).toBe("function");
|
|
});
|
|
|
|
it("resolves IListMediaUseCase as a function", () => {
|
|
const uc = mediaContainer.get(MEDIA_SYMBOLS.IListMediaUseCase);
|
|
expect(typeof uc).toBe("function");
|
|
});
|
|
|
|
it("resolves IDeleteMediaUseCase as a function", () => {
|
|
const uc = mediaContainer.get(MEDIA_SYMBOLS.IDeleteMediaUseCase);
|
|
expect(typeof uc).toBe("function");
|
|
});
|
|
});
|