Skip to content

Commit 40df8e9

Browse files
authored
test(svg): add a ghost-city mode integration test in route (JhaSourav07#633)
## Description Fixes JhaSourav07#380 ## Pillar - [ ] 🎨 Pillar 1 β€” New Theme Design - [ ] πŸ“ Pillar 2 β€” Geometric SVG Improvement - [ ] πŸ• Pillar 3 β€” Timezone Logic Optimization - [x] πŸ› οΈ Other (Bug fix, refactoring, docs) ## Visual Preview No visual changes, just adding tests. ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [x] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts). - [x] (Recommended) I joined the CommitPulse Discord server for faster collaboration, mentorship, and PR support.
2 parents 41d913a + c7fcf5e commit 40df8e9

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)