Skip to content

Commit f0ea6e2

Browse files
test: add mock integration tests for svg constants
1 parent 3afecb9 commit f0ea6e2

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+
SVG_WIDTH,
4+
SVG_HEIGHT,
5+
GHOST_HEIGHT_PX,
6+
LOG_SCALE_MULTIPLIER,
7+
LINEAR_SCALE_MULTIPLIER,
8+
MAX_LOG_HEIGHT,
9+
MAX_LINEAR_HEIGHT,
10+
FONT_MAP,
11+
CONTRIBUTION_MILESTONES,
12+
STREAK_MILESTONES,
13+
} from './constants';
14+
15+
describe('lib/svg/constants', () => {
16+
it('should expose expected SVG dimensions', () => {
17+
expect(SVG_WIDTH).toBe(600);
18+
expect(SVG_HEIGHT).toBe(420);
19+
});
20+
21+
it('should expose expected rendering scale constants', () => {
22+
expect(GHOST_HEIGHT_PX).toBe(4);
23+
expect(LOG_SCALE_MULTIPLIER).toBe(12);
24+
expect(LINEAR_SCALE_MULTIPLIER).toBe(5);
25+
expect(MAX_LOG_HEIGHT).toBe(80);
26+
expect(MAX_LINEAR_HEIGHT).toBe(50);
27+
});
28+
29+
it('should expose correct font mappings', () => {
30+
expect(FONT_MAP).toEqual({
31+
jetbrains: '"JetBrains Mono", monospace',
32+
fira: '"Fira Code", monospace',
33+
roboto: '"Roboto", sans-serif',
34+
});
35+
});
36+
37+
it('should expose expected contribution milestones', () => {
38+
expect(CONTRIBUTION_MILESTONES).toEqual([1, 10, 100, 250, 500, 1000]);
39+
});
40+
41+
it('should expose expected streak milestones', () => {
42+
expect(STREAK_MILESTONES).toEqual([3, 7, 30, 100]);
43+
});
44+
});

0 commit comments

Comments
 (0)