Skip to content

Commit c7fcf5e

Browse files
committed
test(svg): add ghost-city mode integration test in route
1 parent cbaa93f commit c7fcf5e

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

app/api/streak/route.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,4 +472,24 @@ describe('GET /api/streak', () => {
472472
expect(response.headers.get('Cache-Control')).toBe('no-cache, no-store, must-revalidate');
473473
});
474474
});
475+
476+
describe('Ghost City Mode (route integration)', () => {
477+
it('returns ghost city SVG when user has 0 total contributions', async () => {
478+
const emptyCalendar: ContributionCalendar = {
479+
totalContributions: 0,
480+
weeks: [
481+
{
482+
contributionDays: [{ contributionCount: 0, date: '2024-06-10' }],
483+
},
484+
],
485+
};
486+
487+
vi.mocked(fetchGitHubContributions).mockResolvedValue(emptyCalendar);
488+
const response = await GET(makeRequest({ user: 'octocat' }));
489+
const body = await response.text();
490+
491+
expect(body).toContain('stroke-width="0.5"');
492+
expect(body).toContain('stroke-opacity="0.3"');
493+
});
494+
});
475495
});

0 commit comments

Comments
 (0)