refactor(features): split entities into models/ + errors/ subdirs

All 5 features (auth, blog, marketing-pages, navigation; media has no
entities yet) now follow Lazar's pattern:
- entities/<x>.ts → entities/models/<x>.ts
- entities/errors.ts → entities/errors/<domain>.ts + errors/common.ts

Updates all import paths across factories, contracts, tests, use cases,
controllers, repositories, integrations, and src/index.ts exports.

navigation divergence: had no errors.ts; errors/header.ts +
errors/common.ts added as new forward-looking stubs.

Refactor log: docs/superpowers/refactor-logs/2026-05-05-lazar-pattern-conformance.md
Spec: §5, §9.3

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 23:34:32 +02:00
parent 16ca82d7cf
commit a4c4ca6b6e
76 changed files with 150 additions and 99 deletions

View File

@@ -0,0 +1,58 @@
import { describe, expect, it } from "vitest";
import { pageSchema, pageStatusSchema } from "./page";
describe("pageSchema", () => {
it("accepts a minimal valid page", () => {
const result = pageSchema.parse({
id: "p1",
title: "About",
slug: "about",
hero: { heading: "About us" },
layout: [],
seo: { title: "About — My App" },
createdAt: new Date(),
updatedAt: new Date(),
});
expect(result.status).toBe("draft");
expect(result.publishedAt).toBeNull();
});
it("accepts a published page with publishedAt", () => {
const result = pageSchema.parse({
id: "p1",
title: "About",
slug: "about",
hero: { heading: "About us" },
layout: [],
status: "published",
publishedAt: new Date(),
seo: { title: "About" },
createdAt: new Date(),
updatedAt: new Date(),
});
expect(result.status).toBe("published");
expect(result.publishedAt).toBeInstanceOf(Date);
});
it("rejects empty title", () => {
expect(() =>
pageSchema.parse({
id: "p1",
title: "",
slug: "about",
hero: { heading: "h" },
layout: [],
seo: { title: "x" },
createdAt: new Date(),
updatedAt: new Date(),
}),
).toThrow();
});
});
describe("pageStatusSchema", () => {
it("accepts draft and published", () => {
expect(pageStatusSchema.parse("draft")).toBe("draft");
expect(pageStatusSchema.parse("published")).toBe("published");
});
});