|
| 1 | +import { describe, expect, it } from 'vitest'; |
| 2 | +import { |
| 3 | + CONTRIBUTION_MILESTONES, |
| 4 | + FONT_MAP, |
| 5 | + GHOST_HEIGHT_PX, |
| 6 | + LINEAR_SCALE_MULTIPLIER, |
| 7 | + LOG_SCALE_MULTIPLIER, |
| 8 | + MAX_LINEAR_HEIGHT, |
| 9 | + MAX_LOG_HEIGHT, |
| 10 | + STREAK_MILESTONES, |
| 11 | + SVG_HEIGHT, |
| 12 | + SVG_WIDTH, |
| 13 | +} from './constants'; |
| 14 | + |
| 15 | +describe('SVG constants error resilience', () => { |
| 16 | + it('provides stable dimensions during hydration', () => { |
| 17 | + expect(SVG_WIDTH).toBeGreaterThan(0); |
| 18 | + expect(SVG_HEIGHT).toBeGreaterThan(0); |
| 19 | + }); |
| 20 | + |
| 21 | + it('provides safe fallback scaling values', () => { |
| 22 | + expect(GHOST_HEIGHT_PX).toBeGreaterThan(0); |
| 23 | + expect(LOG_SCALE_MULTIPLIER).toBeGreaterThan(0); |
| 24 | + expect(LINEAR_SCALE_MULTIPLIER).toBeGreaterThan(0); |
| 25 | + expect(MAX_LOG_HEIGHT).toBeGreaterThan(0); |
| 26 | + expect(MAX_LINEAR_HEIGHT).toBeGreaterThan(0); |
| 27 | + }); |
| 28 | + |
| 29 | + it('provides font fallbacks for rendering recovery', () => { |
| 30 | + expect(FONT_MAP.jetbrains).toContain('monospace'); |
| 31 | + expect(FONT_MAP.fira).toContain('monospace'); |
| 32 | + expect(FONT_MAP.roboto).toContain('sans-serif'); |
| 33 | + }); |
| 34 | + |
| 35 | + it('maintains valid contribution milestone fallback data', () => { |
| 36 | + expect(CONTRIBUTION_MILESTONES.length).toBeGreaterThan(0); |
| 37 | + expect(CONTRIBUTION_MILESTONES.every((v) => v > 0)).toBe(true); |
| 38 | + }); |
| 39 | + |
| 40 | + it('maintains valid streak milestone fallback data', () => { |
| 41 | + expect(STREAK_MILESTONES.length).toBeGreaterThan(0); |
| 42 | + expect(STREAK_MILESTONES.every((v) => v > 0)).toBe(true); |
| 43 | + }); |
| 44 | +}); |
0 commit comments