refactor(navigation): factory-style use case + controller

- Use case (get-header) → factory function with IGetHeaderUseCase alias
- Controller renamed header.controller.ts → get-header.controller.ts (verb-noun); converted to factory function with IGetHeaderController alias
- DI module wires factories with .toDynamicValue()
- tRPC router resolves controller via container
- Use case + controller tests refactored to direct factory injection (no container rebinding)
- container.test.ts verifies IGetHeaderUseCase + IGetHeaderController symbols

Refactor log: §1, §4.1, §4.2, §5.1
Spec: §6.4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 00:19:15 +02:00
parent 353a41b244
commit 69623b995d
11 changed files with 104 additions and 46 deletions

View File

@@ -4,6 +4,8 @@ import { NAVIGATION_SYMBOLS } from "./symbols";
import { NavigationModule } from "./module";
import { MockHeaderRepository } from "@/infrastructure/repositories/header.repository.mock";
import type { IHeaderRepository } from "@/application/repositories/header.repository.interface";
import type { IGetHeaderUseCase } from "@/application/use-cases/get-header.use-case";
import type { IGetHeaderController } from "@/interface-adapters/controllers/get-header.controller";
describe("navigationContainer", () => {
beforeEach(() => {
@@ -21,4 +23,18 @@ describe("navigationContainer", () => {
);
expect(repo).toBeInstanceOf(MockHeaderRepository);
});
it("resolves IGetHeaderUseCase as a function", () => {
const useCase = navigationContainer.get<IGetHeaderUseCase>(
NAVIGATION_SYMBOLS.IGetHeaderUseCase,
);
expect(typeof useCase).toBe("function");
});
it("resolves IGetHeaderController as a function", () => {
const controller = navigationContainer.get<IGetHeaderController>(
NAVIGATION_SYMBOLS.IGetHeaderController,
);
expect(typeof controller).toBe("function");
});
});