Files
agentic-dev/packages/navigation/src/__factories__/header.factory.test.ts
Danijel Martinek a74f217703 fix(features): address Task 3 code review feedback
- Add navItemFactory to navigation (spec §5.1 — was missing)
- Refactor blog/router.test.ts to use articleFactory (eliminate new Date())
- headerFactory uses sequence for logoId (deterministic buildList output)
- Align media/tsconfig.json with other features (jsx + tests/ include)
- Refactor auth/container.test.ts to use userFactory

Reviewer: superpowers:code-reviewer (Task 3 of Plan 7).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 15:18:35 +02:00

37 lines
1.2 KiB
TypeScript

import { describe, it, expect, beforeEach } from "vitest";
import { headerFactory } from "@/__factories__/header.factory";
describe("headerFactory", () => {
beforeEach(() => headerFactory.reset());
it("returns a Header with stable defaults", () => {
const h = headerFactory.build();
expect(h.items).toHaveLength(0);
expect(h.logoId).toBe("logo-1");
});
it("applies overrides", () => {
const h = headerFactory.build({
logoId: "logo-42",
items: [{ label: "Home", href: "/", external: false }],
});
expect(h.logoId).toBe("logo-42");
expect(h.items).toHaveLength(1);
expect(h.items[0]?.label).toBe("Home");
});
it("builds multiple headers independently", () => {
const a = headerFactory.build({ items: [{ label: "A", href: "/a", external: false }] });
const b = headerFactory.build({ items: [] });
expect(a.items).toHaveLength(1);
expect(b.items).toHaveLength(0);
});
it("logoId reflects sequence for deterministic buildList output", () => {
const first = headerFactory.build();
const second = headerFactory.build();
expect(first.logoId).toBe("logo-1");
expect(second.logoId).toBe("logo-2");
});
});