Skip to content

Commit 3263901

Browse files
authored
test: add svg constants timezone boundary coverage (JhaSourav07#3119)
## Description Fixes JhaSourav07#2890 Added `lib/svg/constants.timezone-boundaries.test.ts` to provide timezone normalization and calendar boundary alignment test coverage for SVG constants. ### Coverage Added * Verifies SVG dimensions remain stable across timezone offsets. * Verifies contribution milestone ordering during calendar date transitions. * Verifies streak milestone ordering across day-boundary normalization. * Ensures contribution milestones remain unique during timezone rollover calculations. * Ensures streak milestones remain unique during timezone rollover calculations. ## Pillar * [x] 🕐 Pillar 3 — Timezone Logic Optimization ## Visual Preview N/A (test-only change) ## Checklist before requesting a review: * [x] I have read the `CONTRIBUTING.md` file. * [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). * [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 started the repo. * [x] I have made sure that I have only one commit to merge in this PR. * [ ] The SVG output matches the CommitPulse "premium quality" aesthetic standard (not applicable for a test-only change). * [ ] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 36188bd + 0f75ee5 commit 3263901

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { describe, expect, it } from 'vitest';
2+
import { CONTRIBUTION_MILESTONES, STREAK_MILESTONES, SVG_HEIGHT, SVG_WIDTH } from './constants';
3+
4+
describe('SVG constants timezone boundary alignment', () => {
5+
it('maintains stable SVG dimensions across timezone offsets', () => {
6+
expect(SVG_WIDTH).toBe(600);
7+
expect(SVG_HEIGHT).toBe(420);
8+
});
9+
10+
it('preserves contribution milestone ordering during calendar date transitions', () => {
11+
const sorted = [...CONTRIBUTION_MILESTONES].sort((a, b) => a - b);
12+
expect(CONTRIBUTION_MILESTONES).toEqual(sorted);
13+
});
14+
15+
it('preserves streak milestone ordering across day boundary normalization', () => {
16+
const sorted = [...STREAK_MILESTONES].sort((a, b) => a - b);
17+
expect(STREAK_MILESTONES).toEqual(sorted);
18+
});
19+
20+
it('uses unique contribution milestones when activity shifts between dates', () => {
21+
expect(new Set(CONTRIBUTION_MILESTONES).size).toBe(CONTRIBUTION_MILESTONES.length);
22+
});
23+
24+
it('uses unique streak milestones during timezone rollover calculations', () => {
25+
expect(new Set(STREAK_MILESTONES).size).toBe(STREAK_MILESTONES.length);
26+
});
27+
});

0 commit comments

Comments
 (0)