import { describe, it, expect } from 'vitest'; import { BARRAS_SIMBOLO, LINEAS_SIMBOLO } from '@/lib/simbolo'; describe('geometría del ≡', () => { it('define exactly the three bars of the mark', () => { expect(BARRAS_SIMBOLO).toHaveLength(3); }); it('keeps the three bars aligned and equal in width', () => { const anchos = new Set(BARRAS_SIMBOLO.map((b) => b.width)); const izquierdas = new Set(BARRAS_SIMBOLO.map((b) => b.x)); expect(anchos.size).toBe(1); expect(izquierdas.size).toBe(1); }); it('holds the Manual proportions that make the mark read as an E', () => { const [b1, b2, b3] = BARRAS_SIMBOLO; // Measured off the Manual and traced in Wordmark.tsx. Stubbier bars or // tighter gaps than these and the ≡ reads as a hamburger menu icon. expect(b1.width / b1.height).toBeCloseTo(5.919, 3); expect((b2.y - (b1.y + b1.height)) / b1.height).toBeCloseTo(2, 6); expect(b3.y - b2.y).toBeCloseTo(b2.y - b1.y, 6); }); it('centres the mark in its own viewBox', () => { const [b1, , b3] = BARRAS_SIMBOLO; expect(b1.y).toBeCloseTo(64 - (b3.y + b3.height), 6); expect(b1.x).toBeCloseTo(64 - (b1.x + b1.width), 6); }); it('reproduces each bar exactly when drawn as a round-capped stroke', () => { BARRAS_SIMBOLO.forEach((barra, i) => { const linea = LINEAS_SIMBOLO[i]; // A round cap reaches half the stroke width past its endpoint, so an // un-inset line would draw a pill a full thickness longer than the bar. expect(linea.x1 - linea.grosor / 2).toBeCloseTo(barra.x, 6); expect(linea.x2 + linea.grosor / 2).toBeCloseTo(barra.x + barra.width, 6); expect(linea.y1).toBeCloseTo(barra.y + barra.height / 2, 6); expect(linea.y2).toBeCloseTo(linea.y1, 6); }); }); });