Skip to content

Commit 734e8e1

Browse files
Merge branch 'main' into thememock
2 parents 8807c27 + 5dc4da7 commit 734e8e1

9 files changed

Lines changed: 14 additions & 10 deletions

File tree

app/api/streak/route.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,15 @@ describe('GET /api/streak', () => {
443443
it('caches until UTC midnight by default, using the value from getSecondsUntilUTCMidnight', async () => {
444444
const response = await GET(makeRequest({ user: 'octocat' }));
445445
expect(response.headers.get('Cache-Control')).toBe(
446-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
446+
'public, max-age=60, s-maxage=3600, stale-while-revalidate=59'
447447
);
448448
});
449449

450450
it('reflects a different time value when the clock changes', async () => {
451451
vi.mocked(getSecondsUntilUTCMidnight).mockReturnValue(7200);
452452
const response = await GET(makeRequest({ user: 'octocat' }));
453453
expect(response.headers.get('Cache-Control')).toBe(
454-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
454+
'public, max-age=60, s-maxage=7200, stale-while-revalidate=59'
455455
);
456456
});
457457

@@ -1013,7 +1013,7 @@ describe('GET /api/streak', () => {
10131013
const response = await GET(makeRequest({ user: 'octocat', tz: 'America/New_York' }));
10141014

10151015
expect(response.headers.get('Cache-Control')).toBe(
1016-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
1016+
'public, max-age=60, s-maxage=7200, stale-while-revalidate=59'
10171017
);
10181018
expect(getSecondsUntilMidnightInTimezone).toHaveBeenCalledWith('America/New_York');
10191019
expect(getSecondsUntilUTCMidnight).not.toHaveBeenCalled();

app/api/streak/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ export async function GET(request: Request) {
579579
: getSecondsUntilUTCMidnight();
580580
const cacheControl = isRefreshRequested
581581
? 'no-cache, no-store, must-revalidate'
582-
: `public, s-maxage=1, stale-while-revalidate=86400`;
582+
: `public, s-maxage=${secondsToMidnight}, stale-while-revalidate=86400`;
583583

584584
const cacheStatusHeader = shouldBypassCache
585585
? `BYPASS, fetched=${new Date().toISOString()}`
@@ -694,7 +694,7 @@ export async function GET(request: Request) {
694694
? 'no-cache, no-store, must-revalidate'
695695
: isHistoricalYear
696696
? 'public, max-age=31536000, s-maxage=31536000, immutable'
697-
: `public, max-age=60, s-maxage=1, stale-while-revalidate=59`;
697+
: `public, max-age=60, s-maxage=${secondsToMidnight}, stale-while-revalidate=59`;
698698

699699
const etag = crypto.createHash('sha256').update(svg).digest('hex');
700700
const weakEtag = `W/"${etag}"`;

app/api/streak/tests/dateRange.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('GET /api/streak dateRange parameter', () => {
118118
expect(res.status).toBe(200);
119119
expect(res.headers.get('Content-Type')).toBe('image/svg+xml; charset=utf-8');
120120
expect(res.headers.get('Cache-Control')).toBe(
121-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
121+
'public, max-age=60, s-maxage=3600, stale-while-revalidate=59'
122122
);
123123
});
124124
});

app/api/streak/tests/refresh.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('GET /api/streak - refresh parameter group', () => {
105105

106106
expect(response.status).toBe(200);
107107
expect(response.headers.get('Cache-Control')).toBe(
108-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
108+
'public, max-age=60, s-maxage=3600, stale-while-revalidate=59'
109109
);
110110
expect(response.headers.get('X-Cache-Status')).toBe('HIT');
111111
});

app/api/streak/tests/views.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ describe('GET /api/streak view parameter integration', () => {
159159
expect(response.status).toBe(200);
160160
expect(response.headers.get('Content-Type')).toBe('image/svg+xml; charset=utf-8');
161161
expect(response.headers.get('Cache-Control')).toBe(
162-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
162+
'public, max-age=60, s-maxage=3600, stale-while-revalidate=59'
163163
);
164164
expect(response.headers.get('X-Cache-Status')).toBe('HIT');
165165
});

app/api/streak/tests/weekday.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('GET /api/streak?view=weekday', () => {
131131

132132
expect(response.status).toBe(200);
133133
expect(response.headers.get('Cache-Control')).toBe(
134-
'public, max-age=60, s-maxage=1, stale-while-revalidate=59'
134+
'public, max-age=60, s-maxage=3600, stale-while-revalidate=59'
135135
);
136136
expect(response.headers.get('X-Cache-Status')).toBe('HIT');
137137
});

app/components/LandingPageClient.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export default function LandingPageClient() {
544544

545545
const handleGenerate = (e: React.FormEvent) => {
546546
e.preventDefault();
547-
if (trimmedUsername.length > 0) {
547+
if (trimmedUsername.length > 0 && trimmedUsername !== previewUsername) {
548548
setInstantUsername(trimmedUsername);
549549
setBadgeResult(null);
550550
trackUser(trimmedUsername);

app/generator/components/EditorPanel.type-compiler.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ describe('EditorPanel Type Compiler Validation', () => {
1919
showSnakeGraph: boolean;
2020
showPacmanGraph: boolean;
2121
graphPlacement: 'top' | 'middle' | 'bottom';
22+
showArticles?: boolean;
23+
articlesPlatform?: 'devto' | 'hashnode';
24+
articlesUsername?: string;
2225
}>();
2326
});
2427

app/generator/components/PreviewPanel.type-compiler.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('PreviewPanel Type Compiler Validation', () => {
1212

1313
expectTypeOf<Props>().toMatchObjectType<{
1414
markdown: string;
15+
hasContent?: boolean;
1516
}>();
1617
});
1718

0 commit comments

Comments
 (0)