import { describe, it, expect } from "vitest"; import { generateFollowMeShape, createProfileShape, createSweepCurvePath, FOLLOW_ME_PROFILE_PRESETS, } from "@/lib/followMeKernel"; describe("Follow Me / Sweep Kernel (Beni Takip Et / Süpürme)", () => { it("has complete preset profiles for architecture", () => { expect(FOLLOW_ME_PROFILE_PRESETS.length).toBeGreaterThanOrEqual(6); const ids = FOLLOW_ME_PROFILE_PRESETS.map((p) => p.id); expect(ids).toContain("molding"); expect(ids).toContain("baseboard"); expect(ids).toContain("handrail"); expect(ids).toContain("pipe"); expect(ids).toContain("beam"); }); it("creates valid 2D shapes for all profile types", () => { for (const preset of FOLLOW_ME_PROFILE_PRESETS) { const shape = createProfileShape(preset.id, 20, 30, 3); expect(shape.curves.length).toBeGreaterThan(0); } }); it("creates valid 3D sweep curve paths", () => { const straightPath = createSweepCurvePath("straight", { pathLength: 150 }); expect(straightPath.curves.length).toBe(1); const cornerPath = createSweepCurvePath("l-corner", { roomWidth: 100, roomDepth: 80 }); expect(cornerPath.curves.length).toBe(2); const perimeterPath = createSweepCurvePath("perimeter", { roomWidth: 200, roomDepth: 150 }); expect(perimeterPath.curves.length).toBe(4); }); it("generates a complete 3D WorkplaneShape with valid mesh data", () => { const shape = generateFollowMeShape({ profileType: "molding", pathPreset: "perimeter", width: 25, height: 30, roomWidth: 200, roomDepth: 150, texture: "wood", }); expect(shape.id).toBeDefined(); expect(shape.kind).toBe("mesh"); expect(shape.name).toContain("Kartonpiyer"); expect(shape.texture).toBe("wood"); expect(shape.importedMesh).toBeDefined(); expect(shape.importedMesh!.positions.length).toBeGreaterThan(100); expect(shape.importedMesh!.normals?.length).toBeGreaterThan(100); expect(shape.width).toBeGreaterThan(150); expect(shape.depth).toBeGreaterThan(100); }); it("supports straight pipe / handrail generation", () => { const pipe = generateFollowMeShape({ profileType: "pipe", pathPreset: "straight", width: 20, height: 20, pathLength: 300, texture: "metal", }); expect(pipe.importedMesh).toBeDefined(); expect(pipe.width).toBeGreaterThan(250); expect(pipe.texture).toBe("metal"); }); });