Skip to content

Commit 0e0e348

Browse files
authored
test(svg): add hideBackground generator coverage (JhaSourav07#777)
* test(svg): add hideBackground generator coverage * style(test): format generator tests
1 parent 1e59cc5 commit 0e0e348

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

lib/svg/generator.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,30 @@ describe('generateSVG', () => {
5858
expect(svg).toContain('svg');
5959
});
6060

61+
it('uses transparent background when hideBackground is true', () => {
62+
const svg = generateSVG(
63+
mockStats,
64+
{
65+
user: 'avi',
66+
hideBackground: true,
67+
} as unknown as BadgeParams,
68+
mockCalendar
69+
);
70+
expect(svg).toContain('fill="transparent"');
71+
});
72+
73+
it('uses normal background when hideBackground is false or omitted', () => {
74+
const svg = generateSVG(
75+
mockStats,
76+
{
77+
user: 'avi',
78+
bg: '0d1117',
79+
} as unknown as BadgeParams,
80+
mockCalendar
81+
);
82+
expect(svg).not.toContain('fill="transparent"');
83+
});
84+
6185
it('generates particles for days with 10 or more contributions', () => {
6286
const svg = generateSVG(mockStats, { user: 'avi' } as unknown as BadgeParams, mockCalendar);
6387
expect(svg).toContain('class="heat-particles"');

0 commit comments

Comments
 (0)