Skip to content

Commit a0e2593

Browse files
authored
test(github route): verify 400 error for username with spaces (JhaSourav07#1122)
2 parents 7311512 + 7538218 commit a0e2593

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
@@ -94,6 +94,13 @@ describe('GET /api/streak', () => {
9494

9595
expect(fetchGitHubContributions).not.toHaveBeenCalled();
9696
});
97+
it('returns 400 when user contains spaces', async () => {
98+
const response = await GET(makeRequest({ user: 'john doe' }));
99+
const body = await response.json();
100+
101+
expect(response.status).toBe(400);
102+
expect(body.details.fieldErrors.user[0]).toContain('Invalid GitHub username');
103+
});
97104

98105
it('returns 400 when user exceeds 39 characters', async () => {
99106
const response = await GET(makeRequest({ user: 'a'.repeat(40) }));

0 commit comments

Comments
 (0)