import { expect, it } from 'vitest' import { routeAll, type RouteInput } from '../app/lib/logic/routing' it('routes 400 crowded wires fast enough to redraw while dragging', () => { const inputs: RouteInput[] = [] const bodies = [] for (let i = 0; i < 400; i++) { const col = i % 20 const row = Math.floor(i / 20) // Sources in a column on the left, targets scattered: many wires want the same columns. inputs.push({ id: `w${i}`, net: `n${i % 150}`, a: [col * 3, row * 3], b: [col * 3 + 8 + (i % 5), row * 3 + ((i * 7) % 11) - 5] }) if (i % 4 === 0) bodies.push({ x: col * 3 + 4, y: row * 3 - 1, w: 2, h: 2 }) } const t = performance.now() routeAll(inputs, bodies, []) const ms = performance.now() - t console.log(`routeAll(400 wires): ${ms.toFixed(1)} ms`) expect(ms).toBeLessThan(250) })