Files
agentic-dev/packages/navigation/src/__factories__/nav-item.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

30 lines
940 B
TypeScript

import { describe, it, expect, beforeEach } from "vitest";
import { navItemFactory } from "@/__factories__/nav-item.factory";
describe("navItemFactory", () => {
beforeEach(() => navItemFactory.reset());
it("returns a HeaderItem with stable defaults", () => {
const item = navItemFactory.build();
expect(item.label).toBe("Item 1");
expect(item.href).toBe("/item-1");
expect(item.external).toBe(false);
});
it("applies overrides", () => {
const item = navItemFactory.build({ label: "Home", href: "/", external: true });
expect(item.label).toBe("Home");
expect(item.href).toBe("/");
expect(item.external).toBe(true);
});
it("increments sequence per build", () => {
const a = navItemFactory.build();
const b = navItemFactory.build();
expect(a.label).toBe("Item 1");
expect(b.label).toBe("Item 2");
expect(a.href).toBe("/item-1");
expect(b.href).toBe("/item-2");
});
});