Skip to content

Commit 7538218

Browse files
committed
test(github route): verify 400 error for username with spaces
1 parent b6bad20 commit 7538218

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/api/streak/route.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ describe('GET /api/streak', () => {
9090

9191
expect(fetchGitHubContributions).not.toHaveBeenCalled();
9292
});
93+
it('returns 400 when user contains spaces', async () => {
94+
const response = await GET(makeRequest({ user: 'john doe' }));
95+
const body = await response.json();
96+
97+
expect(response.status).toBe(400);
98+
expect(body.details.fieldErrors.user[0]).toContain('Invalid GitHub username');
99+
});
93100

94101
it('returns 400 for invalid monthly badge dimensions', async () => {
95102
const invalidDimensionParams: Array<Record<string, string>> = [

0 commit comments

Comments
 (0)