Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/api/streak/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,11 @@ describe('GET /api/streak', () => {
// #ZZZZZZZ contains non-hex characters — schema must reject it with 400
const response = await GET(makeRequest({ user: 'octocat', accent: '#ZZZZZZZ' }));

expect(response.status).toBe(400);
});
it('returns 400 when another invalid hex color is passed as accent (Variation 4)', async () => {
const response = await GET(makeRequest({ user: 'octocat', accent: '#ZZZZZZ' }));

expect(response.status).toBe(400);
});
});
Expand Down
9 changes: 9 additions & 0 deletions lib/validations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,15 @@ describe('streakParamsSchema — accent parameter HEX color validation', () => {
expect(result.success).toBe(false);
});

it('rejects an invalid hex color like "#ZZZZZZ" for accent (Variation 4)', () => {
const result = streakParamsSchema.safeParse({
user: 'octocat',
accent: '#ZZZZZZ',
});

expect(result.success).toBe(false);
});

it('accepts a valid 6-character hex color for accent', () => {
const result = streakParamsSchema.safeParse({
user: 'octocat',
Expand Down
Loading