Skip to content

Commit cde6d75

Browse files
authored
test(svg): add mouse interactivity coverage (JhaSourav07#3143)
## Description Fixes JhaSourav07#2887 Added isolated unit tests for `lib/svg/constants.ts` focusing on configuration stability, milestone integrity, and SVG rendering prerequisites. ### Changes - Added `lib/svg/constants.mouse-interactivity.test.ts` - Verified SVG dimension constants contain valid positive values - Tested font mapping definitions used throughout SVG rendering - Confirmed contribution milestone values remain ordered and valid - Verified streak milestone values remain ordered and valid - Tested milestone collections contain positive thresholds suitable for downstream interactive features - Improved coverage around SVG configuration constants and rendering-related data structures ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (test-only changes) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [ ] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have starred the repo. - [x] I have made sure that I have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no rendering changes made). - [ ] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 85ea539 + 5beebb0 commit cde6d75

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// lib/svg/constants.mouse-interactivity.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 Mouse Interactivity', () => {
13+
it('provides valid SVG dimensions for interactive layouts', () => {
14+
expect(SVG_WIDTH).toBeGreaterThan(0);
15+
expect(SVG_HEIGHT).toBeGreaterThan(0);
16+
});
17+
18+
it('exposes font mappings used by interactive SVG elements', () => {
19+
expect(FONT_MAP).toHaveProperty('jetbrains');
20+
expect(FONT_MAP).toHaveProperty('fira');
21+
expect(FONT_MAP).toHaveProperty('roboto');
22+
});
23+
24+
it('defines contribution milestone values in ascending order', () => {
25+
const sorted = [...CONTRIBUTION_MILESTONES].sort((a, b) => a - b);
26+
27+
expect(CONTRIBUTION_MILESTONES).toEqual(sorted);
28+
});
29+
30+
it('defines streak milestone values in ascending order', () => {
31+
const sorted = [...STREAK_MILESTONES].sort((a, b) => a - b);
32+
33+
expect(STREAK_MILESTONES).toEqual(sorted);
34+
});
35+
36+
it('contains milestone values suitable for interactive overlays', () => {
37+
expect(CONTRIBUTION_MILESTONES.length).toBeGreaterThan(0);
38+
expect(STREAK_MILESTONES.length).toBeGreaterThan(0);
39+
40+
expect(CONTRIBUTION_MILESTONES.every((v) => v > 0)).toBe(true);
41+
expect(STREAK_MILESTONES.every((v) => v > 0)).toBe(true);
42+
});
43+
});

0 commit comments

Comments
 (0)