import { describe, expect, it } from 'vitest'; import { adaptiveGraphCardScale, minimumReadableGraphCardZoom } from '../../src/features/mitre-graph/graph-card-scale'; describe('adaptive graph card scale', () => { it('keeps cards at their readable native size while zoomed out', () => { const scale = adaptiveGraphCardScale(0.08, 0.7, 0.76); expect(scale.screenScale).toBe(0.7); expect(scale.graphScale * 0.08).toBeCloseTo(0.7); }); it('grows gently and remains capped at maximum zoom', () => { const scale = adaptiveGraphCardScale(4, 0.7, 0.76); expect(scale.screenScale).toBe(0.76); expect(scale.graphScale * 4).toBeCloseTo(0.76); }); it('keeps individual cards available but requires more zoom for dense extracts', () => { expect(minimumReadableGraphCardZoom(1)).toBe(0); expect(minimumReadableGraphCardZoom(2)).toBe(0); expect(minimumReadableGraphCardZoom(20)).toBeGreaterThan(0.6); expect(minimumReadableGraphCardZoom(200)).toBeLessThanOrEqual(0.8); }); });