Skip to content

Commit 67a522c

Browse files
committed
test(route): verify invalid view falls back to default
1 parent e9da96e commit 67a522c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

app/api/streak/route.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ describe('GET /api/streak', () => {
8787
vi.mocked(getSecondsUntilMidnightInTimezone).mockReturnValue(7200);
8888
});
8989

90+
it('falls back to the default isometric view when an invalid view is provided', async () => {
91+
const request = new Request('http://localhost:3000/api/streak?user=octocat&view=invalid');
92+
93+
const response = await GET(request);
94+
95+
expect(response.status).toBe(200);
96+
97+
const body = await response.text();
98+
99+
expect(body).toContain('@keyframes grow-up');
100+
});
101+
90102
describe('parameter validation', () => {
91103
it('returns 400 when the user parameter is missing', async () => {
92104
const response = await GET(makeRequest());

0 commit comments

Comments
 (0)