Skip to content

Commit eddbf2c

Browse files
committed
test(generator): add coverage for hide_title parameter in generateSVG
1 parent 9b64cab commit eddbf2c

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)