Skip to content

Commit fdc8685

Browse files
authored
test(generatorConstants): create generatorConstants tests (JhaSourav07#1187)
## Description Fixes JhaSourav07#1014 Created a new test file for `lib/svg/generatorConstants.ts` covering all exported constants and helper behavior. Tests included: * `SVG_WIDTH === 600` * `SVG_HEIGHT === 420` * `FONT_MAP.jetbrains` contains `"JetBrains Mono"` * `FONT_MAP.fira` contains `"Fira Code"` * `FONT_MAP.roboto` contains `"Roboto"` * `isFontKey('jetbrains')` returns `true` * `isFontKey('roboto')` returns `true` * `isFontKey('unknown-font')` returns `false` * `isFontKey('')` returns `false` ## 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 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). * [x] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents e9da96e + d20a1e7 commit fdc8685

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

lib/svg/generatorConstants.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { SVG_WIDTH, SVG_HEIGHT, FONT_MAP, isFontKey } from './generatorConstants';
3+
4+
describe('generatorConstants', () => {
5+
it('SVG_WIDTH equals 600', () => {
6+
expect(SVG_WIDTH).toBe(600);
7+
});
8+
9+
it('SVG_HEIGHT equals 420', () => {
10+
expect(SVG_HEIGHT).toBe(420);
11+
});
12+
13+
it('FONT_MAP jetbrains contains JetBrains Mono', () => {
14+
expect(FONT_MAP.jetbrains).toContain('JetBrains Mono');
15+
});
16+
17+
it('FONT_MAP fira contains Fira Code', () => {
18+
expect(FONT_MAP.fira).toContain('Fira Code');
19+
});
20+
21+
it('FONT_MAP roboto contains Roboto', () => {
22+
expect(FONT_MAP.roboto).toContain('Roboto');
23+
});
24+
25+
it('isFontKey returns true for jetbrains', () => {
26+
expect(isFontKey('jetbrains')).toBe(true);
27+
});
28+
29+
it('isFontKey returns true for roboto', () => {
30+
expect(isFontKey('roboto')).toBe(true);
31+
});
32+
33+
it('isFontKey returns false for unknown-font', () => {
34+
expect(isFontKey('unknown-font')).toBe(false);
35+
});
36+
37+
it('isFontKey returns false for empty string', () => {
38+
expect(isFontKey('')).toBe(false);
39+
});
40+
});

0 commit comments

Comments
 (0)