|
| 1 | +// lib/svg/constants.accessibility.test.ts |
| 2 | + |
| 3 | +import { describe, expect, it } from 'vitest'; |
| 4 | +import { |
| 5 | + SVG_WIDTH, |
| 6 | + SVG_HEIGHT, |
| 7 | + FONT_MAP, |
| 8 | + CONTRIBUTION_MILESTONES, |
| 9 | + STREAK_MILESTONES, |
| 10 | +} from './constants'; |
| 11 | + |
| 12 | +describe('SVG Constants Accessibility', () => { |
| 13 | + it('provides valid SVG dimensions for accessible rendering', () => { |
| 14 | + expect(SVG_WIDTH).toBeGreaterThan(0); |
| 15 | + expect(SVG_HEIGHT).toBeGreaterThan(0); |
| 16 | + }); |
| 17 | + |
| 18 | + it('exposes readable font mappings for SVG text content', () => { |
| 19 | + expect(FONT_MAP).toHaveProperty('jetbrains'); |
| 20 | + expect(FONT_MAP).toHaveProperty('fira'); |
| 21 | + expect(FONT_MAP).toHaveProperty('roboto'); |
| 22 | + |
| 23 | + Object.values(FONT_MAP).forEach((font) => { |
| 24 | + expect(typeof font).toBe('string'); |
| 25 | + expect(font.length).toBeGreaterThan(0); |
| 26 | + }); |
| 27 | + }); |
| 28 | + |
| 29 | + it('defines contribution milestone values suitable for accessible labels', () => { |
| 30 | + expect(CONTRIBUTION_MILESTONES.length).toBeGreaterThan(0); |
| 31 | + |
| 32 | + CONTRIBUTION_MILESTONES.forEach((value) => { |
| 33 | + expect(value).toBeGreaterThan(0); |
| 34 | + }); |
| 35 | + }); |
| 36 | + |
| 37 | + it('defines streak milestone values suitable for accessible labels', () => { |
| 38 | + expect(STREAK_MILESTONES.length).toBeGreaterThan(0); |
| 39 | + |
| 40 | + STREAK_MILESTONES.forEach((value) => { |
| 41 | + expect(value).toBeGreaterThan(0); |
| 42 | + }); |
| 43 | + }); |
| 44 | + |
| 45 | + it('maintains ascending milestone ordering for predictable narration', () => { |
| 46 | + expect(CONTRIBUTION_MILESTONES).toEqual([...CONTRIBUTION_MILESTONES].sort((a, b) => a - b)); |
| 47 | + |
| 48 | + expect(STREAK_MILESTONES).toEqual([...STREAK_MILESTONES].sort((a, b) => a - b)); |
| 49 | + }); |
| 50 | +}); |
0 commit comments