Skip to content

Commit 5347707

Browse files
test: add LoC mode generator test (issue JhaSourav07#1081)
1 parent e6b5723 commit 5347707

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

lib/svg/generator.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,38 @@ describe('generateSVG', () => {
355355
expect(svg).toContain('CURRENT_STREAK');
356356
});
357357

358+
describe('LoC Mode', () => {
359+
it('renders towers when LoC data exists (not ghost city)', () => {
360+
const locCalendar: ContributionCalendar = {
361+
totalContributions: 0,
362+
weeks: [
363+
{
364+
contributionDays: [
365+
{
366+
contributionCount: 0,
367+
locAdditions: 50,
368+
locDeletions: 10,
369+
date: '2024-06-10',
370+
},
371+
],
372+
},
373+
],
374+
} as ContributionCalendar;
375+
376+
const svg = generateSVG(
377+
mockStats,
378+
{ user: 'avi', mode: 'loc' } as unknown as BadgeParams,
379+
locCalendar
380+
);
381+
382+
// Should contain towers (LoC data exists, so it should not render the ghost city)
383+
expect(svg).toContain('class="cp-tower');
384+
385+
// Should NOT contain stroke-width="0.5" (the ghost city marker)
386+
expect(svg).not.toContain('stroke-width="0.5"');
387+
});
388+
});
389+
358390
// ── Auto-theme (prefers-color-scheme) tests ──────────────────────────────
359391
// These verify that theme=auto produces an SVG that switches between light
360392
// and dark color palettes using CSS custom properties and a media query,

0 commit comments

Comments
 (0)