Skip to content

Commit 5dbc214

Browse files
committed
test: add svg constants error resilience coverage
1 parent 59be971 commit 5dbc214

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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

Comments
 (0)