Skip to content

Commit 30f4f66

Browse files
authored
test(generateMonthlySVG): verify auto-theme CSS variables (JhaSourav07#1909)
## Description Fixes JhaSourav07#1048 Added a test for `generateMonthlySVG` with `autoTheme: true`. The test verifies that the generated monthly SVG contains: - `--cp-bg` - `--cp-accent` - `prefers-color-scheme: dark` ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview Not applicable — test-only change. ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [ ] 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 (no raw elements, smooth animations, correct fonts). - [ ] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 5ec6322 + 9e5fc0b commit 30f4f66

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/svg/generator.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ describe('generateMonthlySVG', () => {
965965
expect(svg).toContain('width="400"');
966966
expect(svg).toContain('height="200"');
967967
});
968-
969968
it('includes prefers-reduced-motion media query in static monthly SVG output', () => {
970969
const svg = generateMonthlySVG(mockMonthlyStats, {
971970
user: 'octocat',
@@ -987,6 +986,17 @@ describe('generateMonthlySVG', () => {
987986
expect(svg).toContain('transition: none !important');
988987
});
989988

989+
it('includes CSS variables in auto-theme monthly SVG', () => {
990+
const svg = generateMonthlySVG(mockMonthlyStats, {
991+
user: 'octocat',
992+
autoTheme: true,
993+
} as unknown as BadgeParams);
994+
995+
expect(svg).toContain('--cp-bg');
996+
expect(svg).toContain('--cp-accent');
997+
expect(svg).toContain('prefers-color-scheme: dark');
998+
});
999+
9901000
it('supports dynamic Google Fonts for non-predefined fonts in monthly auto-theme mode', () => {
9911001
const svg = generateMonthlySVG(mockMonthlyStats, {
9921002
user: 'octocat',

0 commit comments

Comments
 (0)