Skip to content

Commit 9d4694c

Browse files
authored
test(svg): add accessibility metadata assertions for SVG output (JhaSourav07#463)
## Description Fixes JhaSourav07#400 ## Changes made - Added accessibility-focused test coverage for SVG `<title>` and `<desc>` metadata - Verified `<title>` contains the username - Verified `<desc>` includes total contributions and longest streak values - Ensured all existing tests continue to pass ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview ## 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): ...`). - [x] 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. - [x] 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 a1e8bfb + b872f25 commit 9d4694c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/svg/generator.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,18 @@ describe('generateSVG', () => {
376376

377377
expect(svg).not.toContain('attributeName="opacity" values="1;0.4;1"');
378378
});
379+
it('includes accessible title and description metadata', () => {
380+
const svg = generateSVG(
381+
mockStats,
382+
{ user: 'octocat' } as unknown as BadgeParams,
383+
mockCalendar
384+
);
385+
386+
expect(svg).toContain('<title>CommitPulse Stats for octocat</title>');
387+
expect(svg).toContain('<desc>');
388+
expect(svg).toContain('100');
389+
expect(svg).toContain('10');
390+
});
379391
});
380392

381393
describe('tower top highlight', () => {

0 commit comments

Comments
 (0)