Skip to content

Commit b5cc44c

Browse files
authored
test: cover auto theme in streak route (JhaSourav07#602)
## Description - add one focused route-level test for the ?theme=auto path in �pp/api/streak/route.test.ts - assert the response stays 200 - assert the generated SVG includes both prefers-color-scheme: dark and the --cp-bg CSS variable - keep the change test-only and aligned with issue JhaSourav07#396 ## Pillar - Testing ## Checklist - [x] Linked to the assigned issue - [x] Kept the change scoped to the requested file - [x] Added the exact assertions requested by the issue - [x] Ran git diff --check - [ ] Full local test suite not run in this workspace because dependencies are not installed here and the machine is nearly out of disk space Closes JhaSourav07#396
2 parents ad0f996 + e2a3c87 commit b5cc44c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

app/api/streak/route.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ describe('GET /api/streak', () => {
307307
expect(response.status).toBe(200);
308308
});
309309

310+
it('returns auto-theme SVG markup with dark-mode CSS variables when theme=auto', async () => {
311+
const response = await GET(makeRequest({ user: 'octocat', theme: 'auto' }));
312+
const body = await response.text();
313+
314+
expect(response.status).toBe(200);
315+
expect(body).toContain('prefers-color-scheme: dark');
316+
expect(body).toContain('--cp-bg');
317+
});
318+
310319
it('falls back to the dark theme without crashing when an unknown theme is given', async () => {
311320
const response = await GET(makeRequest({ user: 'octocat', theme: 'does-not-exist' }));
312321
const body = await response.text();

0 commit comments

Comments
 (0)