Skip to content

Commit 7dedd62

Browse files
authored
Un-skip tests in prefetch-runtime.test.ts (#86097)
These were temporarily disabled when removed the Link level opt-in for runtime prefetching. I fixed the tests by switching to the file-based API. prefetch-layout-sharing.test.ts still needs to be updated, in a similar way.
1 parent a8d73c2 commit 7dedd62

File tree

16 files changed

+87
-158
lines changed

16 files changed

+87
-158
lines changed

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/caches/private-seconds/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { Suspense } from 'react'
22
import { cachedDelay, DebugRenderKind } from '../../../shared'
33
import { cacheLife } from 'next/cache'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/caches/private-short-stale/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { Suspense } from 'react'
22
import { cachedDelay, DebugRenderKind } from '../../../shared'
33
import { cacheLife } from 'next/cache'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/caches/public-seconds/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { Suspense } from 'react'
22
import { cachedDelay, DebugRenderKind } from '../../../shared'
33
import { cacheLife } from 'next/cache'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/caches/public-short-expire-long-stale/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { Suspense } from 'react'
22
import { cachedDelay, DebugRenderKind } from '../../../shared'
33
import { cacheLife } from 'next/cache'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/caches/public-short-expire-short-stale/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { Suspense } from 'react'
22
import { cachedDelay, DebugRenderKind } from '../../../shared'
33
import { cacheLife } from 'next/cache'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/errors/error-after-cookies/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { Suspense } from 'react'
33
import { cachedDelay, DebugRenderKind } from '../../../shared'
44
import { ErrorBoundary } from '../../../../components/error-boundary'
55

6+
export const unstable_prefetch = {
7+
mode: 'runtime',
8+
samples: [{ cookies: [] }],
9+
}
10+
611
export default async function Page() {
712
return (
813
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/errors/page.tsx

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,29 @@ export default async function Page() {
88
<h2>thrown errors</h2>
99
<ul>
1010
<li>
11-
<DebugLinkAccordion
12-
href="/errors/error-after-cookies"
13-
prefetch={true}
14-
/>
11+
<DebugLinkAccordion href="/errors/error-after-cookies" />
1512
</li>
1613
</ul>
1714

1815
<h2>sync IO</h2>
1916
<ul>
2017
<li>
21-
<DebugLinkAccordion
22-
href="/errors/sync-io-after-runtime-api/cookies"
23-
prefetch={true}
24-
/>
18+
<DebugLinkAccordion href="/errors/sync-io-after-runtime-api/cookies" />
2519
</li>
2620
<li>
27-
<DebugLinkAccordion
28-
href="/errors/sync-io-after-runtime-api/headers"
29-
prefetch={true}
30-
/>
21+
<DebugLinkAccordion href="/errors/sync-io-after-runtime-api/headers" />
3122
</li>
3223
<li>
33-
<DebugLinkAccordion
34-
href="/errors/sync-io-after-runtime-api/dynamic-params/123"
35-
prefetch={true}
36-
/>
24+
<DebugLinkAccordion href="/errors/sync-io-after-runtime-api/dynamic-params/123" />
3725
</li>
3826
<li>
39-
<DebugLinkAccordion
40-
href="/errors/sync-io-after-runtime-api/search-params?foo=bar"
41-
prefetch={true}
42-
/>
27+
<DebugLinkAccordion href="/errors/sync-io-after-runtime-api/search-params?foo=bar" />
4328
</li>
4429
<li>
45-
<DebugLinkAccordion
46-
href="/errors/sync-io-after-runtime-api/private-cache"
47-
prefetch={true}
48-
/>
30+
<DebugLinkAccordion href="/errors/sync-io-after-runtime-api/private-cache" />
4931
</li>
5032
<li>
51-
<DebugLinkAccordion
52-
href="/errors/sync-io-after-runtime-api/quickly-expiring-public-cache"
53-
prefetch={true}
54-
/>
33+
<DebugLinkAccordion href="/errors/sync-io-after-runtime-api/quickly-expiring-public-cache" />
5534
</li>
5635
</ul>
5736
</main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/errors/sync-io-after-runtime-api/cookies/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { cookies } from 'next/headers'
22
import { Suspense } from 'react'
33
import { DebugRenderKind } from '../../../../shared'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/errors/sync-io-after-runtime-api/dynamic-params/[id]/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { workUnitAsyncStorage } from 'next/dist/server/app-render/work-unit-asyn
44

55
type Params = { id: string }
66

7+
export const unstable_prefetch = {
8+
mode: 'runtime',
9+
samples: [{ cookies: [] }],
10+
}
11+
712
export default async function Page({ params }: { params: Promise<Params> }) {
813
return (
914
<main>

test/e2e/app-dir/segment-cache/prefetch-runtime/app/(default)/errors/sync-io-after-runtime-api/headers/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { headers } from 'next/headers'
22
import { Suspense } from 'react'
33
import { DebugRenderKind } from '../../../../shared'
44

5+
export const unstable_prefetch = {
6+
mode: 'runtime',
7+
samples: [{ cookies: [] }],
8+
}
9+
510
export default async function Page() {
611
return (
712
<main>

0 commit comments

Comments
 (0)