Skip to content

Commit 11678b4

Browse files
authored
test(generator): add coverage for hide_title parameter in generateSVG (JhaSourav07#901)
## Description Fixes JhaSourav07#722 - Added generator-level test coverage for the `hide_title` parameter, verifying that the `username title` is correctly `omitted` when `enabled`. - Added a complementary assertion ensuring the uppercase username title still renders normally when `hide_title` is disabled. ## Pillar - 🛠️ Other (Bug fix, refactoring, docs) ## Checklist before requesting a review: - I have read the `CONTRIBUTING.md` file. - I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). - I have run `npm run format` and `npm run lint` locally and resolved all errors. - My commits follow the Conventional Commits format. - I have starred the repo. - I have made sure that i have only one commit to merge in this PR.
2 parents 1a52708 + eddbf2c commit 11678b4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

lib/svg/generator.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,28 @@ describe('generateSVG', () => {
511511
expect(svg).not.toContain('fill="white" fill-opacity="0.2"');
512512
});
513513
});
514+
515+
describe('hide_title parameter', () => {
516+
it('omits the username title text when hide_title is true', () => {
517+
const svg = generateSVG(
518+
mockStats,
519+
{ user: 'octocat', hide_title: true } as unknown as BadgeParams,
520+
mockCalendar
521+
);
522+
523+
expect(svg).not.toContain('OCTOCAT');
524+
});
525+
526+
it('renders the username title text when hide_title is false', () => {
527+
const svg = generateSVG(
528+
mockStats,
529+
{ user: 'octocat', hide_title: false } as unknown as BadgeParams,
530+
mockCalendar
531+
);
532+
533+
expect(svg).toContain('OCTOCAT');
534+
});
535+
});
514536
});
515537

516538
describe('generateMonthlySVG', () => {

0 commit comments

Comments
 (0)