Skip to content

Commit 729912b

Browse files
authored
test(svg): add massive scaling coverage (JhaSourav07#3146)
## Description Fixes JhaSourav07#2884 Added isolated unit tests for `lib/svg/constants.ts` focusing on configuration stability under simulated large-scale usage and extreme scaling scenarios. ### Changes - Added `lib/svg/constants.massive-scaling.test.ts` - Simulated large contributor datasets and high-volume activity scenarios - Verified SVG dimension constants remain valid under extreme scaling conditions - Tested scaling-related constants for positive and stable values - Confirmed contribution and streak milestone collections remain valid with large data references - Verified repeated access to constants does not introduce configuration drift or state mutation - Improved coverage around scaling limits, stability, and high-load configuration behavior ## 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 a98bc9d + f55a9f5 commit 729912b

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// lib/svg/constants.massive-scaling.test.ts
2+
3+
import { describe, expect, it } from 'vitest';
4+
import {
5+
SVG_WIDTH,
6+
SVG_HEIGHT,
7+
GHOST_HEIGHT_PX,
8+
LOG_SCALE_MULTIPLIER,
9+
LINEAR_SCALE_MULTIPLIER,
10+
MAX_LOG_HEIGHT,
11+
MAX_LINEAR_HEIGHT,
12+
CONTRIBUTION_MILESTONES,
13+
STREAK_MILESTONES,
14+
} from './constants';
15+
16+
describe('SVG Constants Massive Scaling', () => {
17+
it('supports large simulated contribution datasets', () => {
18+
const contributions = Array.from({ length: 10000 }, (_, i) => i + 1);
19+
20+
expect(contributions.length).toBe(10000);
21+
expect(Math.max(...contributions)).toBe(10000);
22+
});
23+
24+
it('maintains positive scaling configuration values', () => {
25+
expect(LOG_SCALE_MULTIPLIER).toBeGreaterThan(0);
26+
expect(LINEAR_SCALE_MULTIPLIER).toBeGreaterThan(0);
27+
expect(MAX_LOG_HEIGHT).toBeGreaterThan(0);
28+
expect(MAX_LINEAR_HEIGHT).toBeGreaterThan(0);
29+
});
30+
31+
it('provides valid SVG dimensions under high-volume scenarios', () => {
32+
expect(SVG_WIDTH).toBeGreaterThan(0);
33+
expect(SVG_HEIGHT).toBeGreaterThan(0);
34+
expect(GHOST_HEIGHT_PX).toBeGreaterThan(0);
35+
});
36+
37+
it('maintains milestone integrity with large data references', () => {
38+
expect(CONTRIBUTION_MILESTONES.every((v) => v > 0)).toBe(true);
39+
expect(STREAK_MILESTONES.every((v) => v > 0)).toBe(true);
40+
});
41+
42+
it('handles repeated access without configuration drift', () => {
43+
for (let i = 0; i < 10000; i++) {
44+
expect(SVG_WIDTH).toBe(600);
45+
expect(SVG_HEIGHT).toBe(420);
46+
}
47+
});
48+
});

0 commit comments

Comments
 (0)