evOo-local/packages/ui-web/src/evoo-brand.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

23 lines
802 B
TypeScript

import { describe, expect, it } from "vitest";
import { pupilOffsetFromPointer } from "./evoo-brand.js";
describe("pupilOffsetFromPointer", () => {
const rect = { left: 100, top: 100, width: 80, height: 80 } as DOMRect;
it("returns zero offset when pointer is centered on mascot", () => {
expect(pupilOffsetFromPointer(140, 140, rect)).toEqual({ x: 0, y: 0 });
});
it("offsets pupils toward the pointer", () => {
const right = pupilOffsetFromPointer(300, 140, rect);
expect(right.x).toBeGreaterThan(0);
expect(Math.abs(right.y)).toBeLessThan(0.5);
});
it("clamps offset magnitude", () => {
const far = pupilOffsetFromPointer(900, 900, rect, 5.8, 450);
const magnitude = Math.hypot(far.x, far.y);
expect(magnitude).toBeLessThanOrEqual(5.8 + 0.001);
});
});