diff --git a/lib/svg/generator.test.ts b/lib/svg/generator.test.ts index e5dbf1080..781bbe279 100644 --- a/lib/svg/generator.test.ts +++ b/lib/svg/generator.test.ts @@ -2695,6 +2695,79 @@ describe('XML Validation - All Generator Outputs', () => { }); }); + describe('label parameter custom title rendering', () => { + const baseParams = { + user: 'avi', + bg: hexColor('0d1117'), + text: hexColor('c9d1d9'), + accent: hexColor('58a6ff'), + speed: '8s', + scale: 'linear', + } as const; + + it('renders custom label instead of uppercase username when custom label is supplied', () => { + const svg = generateSVG( + mockStats, + { + ...baseParams, + label: 'Team Streak', + }, + mockCalendar + ); + + assertValidSVG(svg); + expect(svg).toContain('Team Streak'); + expect(svg).not.toContain('AVI'); + }); + + it('sanitizes custom label to prevent XSS / XML Injection', () => { + const svg = generateSVG( + mockStats, + { + ...baseParams, + label: '', + }, + mockCalendar + ); + + assertValidSVG(svg); + expect(svg).not.toContain('