|
| 1 | +// lib/svg/constants.massive-scaling.test.ts |
| 2 | + |
| 3 | +import { describe, expect, it } from 'vitest'; |
| 4 | +import { |
| 5 | + SVG_WIDTH, |
| 6 | + SVG_HEIGHT, |
| 7 | + GHOST_HEIGHT_PX, |
| 8 | + LOG_SCALE_MULTIPLIER, |
| 9 | + LINEAR_SCALE_MULTIPLIER, |
| 10 | + MAX_LOG_HEIGHT, |
| 11 | + MAX_LINEAR_HEIGHT, |
| 12 | + CONTRIBUTION_MILESTONES, |
| 13 | + STREAK_MILESTONES, |
| 14 | +} from './constants'; |
| 15 | + |
| 16 | +describe('SVG Constants Massive Scaling', () => { |
| 17 | + it('supports large simulated contribution datasets', () => { |
| 18 | + const contributions = Array.from({ length: 10000 }, (_, i) => i + 1); |
| 19 | + |
| 20 | + expect(contributions.length).toBe(10000); |
| 21 | + expect(Math.max(...contributions)).toBe(10000); |
| 22 | + }); |
| 23 | + |
| 24 | + it('maintains positive scaling configuration values', () => { |
| 25 | + expect(LOG_SCALE_MULTIPLIER).toBeGreaterThan(0); |
| 26 | + expect(LINEAR_SCALE_MULTIPLIER).toBeGreaterThan(0); |
| 27 | + expect(MAX_LOG_HEIGHT).toBeGreaterThan(0); |
| 28 | + expect(MAX_LINEAR_HEIGHT).toBeGreaterThan(0); |
| 29 | + }); |
| 30 | + |
| 31 | + it('provides valid SVG dimensions under high-volume scenarios', () => { |
| 32 | + expect(SVG_WIDTH).toBeGreaterThan(0); |
| 33 | + expect(SVG_HEIGHT).toBeGreaterThan(0); |
| 34 | + expect(GHOST_HEIGHT_PX).toBeGreaterThan(0); |
| 35 | + }); |
| 36 | + |
| 37 | + it('maintains milestone integrity with large data references', () => { |
| 38 | + expect(CONTRIBUTION_MILESTONES.every((v) => v > 0)).toBe(true); |
| 39 | + expect(STREAK_MILESTONES.every((v) => v > 0)).toBe(true); |
| 40 | + }); |
| 41 | + |
| 42 | + it('handles repeated access without configuration drift', () => { |
| 43 | + for (let i = 0; i < 10000; i++) { |
| 44 | + expect(SVG_WIDTH).toBe(600); |
| 45 | + expect(SVG_HEIGHT).toBe(420); |
| 46 | + } |
| 47 | + }); |
| 48 | +}); |
0 commit comments