Skip to content

Commit 0e64802

Browse files
lubieowocebgub
authored andcommitted
test: reduce artificial timeouts in runtime prefetch tests (#82276)
the "wait for 500ms" thing was a leftover of me inspecting the test apps visually, we don't need it anymore and it slows the tests down unnecessarily
1 parent a4ff890 commit 0e64802

File tree

24 files changed

+28
-30
lines changed

24 files changed

+28
-30
lines changed

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/runtime-prefetchable-layout/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function Layout({ children }) {
2525
async function RuntimePrefetchable() {
2626
const cookieStore = await cookies()
2727
const cookieValue = cookieStore.get('testCookie')?.value ?? null
28-
await cachedDelay(500, [__filename, cookieValue])
28+
await cachedDelay([__filename, cookieValue])
2929
return (
3030
<div style={{ border: '1px solid blue', padding: '1em' }}>
3131
<div id="cookie-value-layout">{`Cookie from layout: ${cookieValue}`}</div>

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/runtime-prefetchable-layout/one/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Page() {
1616
async function RuntimePrefetchable() {
1717
const cookieStore = await cookies()
1818
const cookieValue = cookieStore.get('testCookie')?.value ?? null
19-
await cachedDelay(500, [__filename, cookieValue])
19+
await cachedDelay([__filename, cookieValue])
2020
return (
2121
<div style={{ border: '1px solid blue', padding: '1em' }}>
2222
<div id="cookie-value-page">{`Cookie from page: ${cookieValue}`}</div>

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/runtime-prefetchable-layout/two/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Page() {
1616
async function RuntimePrefetchable() {
1717
const cookieStore = await cookies()
1818
const cookieValue = cookieStore.get('testCookie')?.value ?? null
19-
await cachedDelay(500, [__filename, cookieValue])
19+
await cachedDelay([__filename, cookieValue])
2020
return (
2121
<div style={{ border: '1px solid blue', padding: '1em' }}>
2222
<div id="cookie-value-page">{`Cookie from page: ${cookieValue}`}</div>

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/shared-layout/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default async function Layout({ children }) {
2626
async function RuntimePrefetchable() {
2727
const cookieStore = await cookies()
2828
const cookieValue = cookieStore.get('testCookie')?.value ?? null
29-
await cachedDelay(500, [__filename, cookieValue])
29+
await cachedDelay([__filename, cookieValue])
3030
return (
3131
<div style={{ border: '1px solid blue', padding: '1em' }}>
3232
<div id="cookie-value-layout">{`Cookie from layout: ${cookieValue}`}</div>

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/shared-layout/one/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Page() {
1616
async function RuntimePrefetchable() {
1717
const cookieStore = await cookies()
1818
const cookieValue = cookieStore.get('testCookie')?.value ?? null
19-
await cachedDelay(500, [__filename, cookieValue])
19+
await cachedDelay([__filename, cookieValue])
2020
return (
2121
<div style={{ border: '1px solid blue', padding: '1em' }}>
2222
<div id="cookie-value-page">{`Cookie from page: ${cookieValue}`}</div>

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/shared-layout/two/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Page() {
1616
async function RuntimePrefetchable() {
1717
const cookieStore = await cookies()
1818
const cookieValue = cookieStore.get('testCookie')?.value ?? null
19-
await cachedDelay(500, [__filename, cookieValue])
19+
await cachedDelay([__filename, cookieValue])
2020
return (
2121
<div style={{ border: '1px solid blue', padding: '1em' }}>
2222
<div id="cookie-value-page">{`Cookie from page: ${cookieValue}`}</div>

test/e2e/app-dir/segment-cache/prefetch-layout-sharing/app/shared.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ import { unstable_cacheLife } from 'next/cache'
22
import { setTimeout } from 'timers/promises'
33

44
export async function uncachedIO() {
5-
await setTimeout(500)
5+
await setTimeout(0)
66
}
77

8-
export async function cachedDelay(time: number, cacheBuster?: any) {
8+
export async function cachedDelay(key: any) {
99
'use cache'
1010
unstable_cacheLife('minutes')
11-
console.log('cachedDelay', time, cacheBuster)
12-
await setTimeout(time)
11+
await setTimeout(1)
1312
}
1413

1514
export function DebugRenderKind() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function CachedButShortLived() {
2525
// the rest of the settings don't matter for private caches,
2626
// because they are not persisted server-side
2727
})
28-
await cachedDelay(500, [__filename])
28+
await cachedDelay([__filename])
2929

3030
return (
3131
<div style={{ border: '1px solid blue', padding: '1em' }}>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function ShortLivedCache() {
2626
revalidate: 2 * 60,
2727
expire: 3 * 60, // < DYNAMIC_EXPIRE
2828
})
29-
await cachedDelay(500, [__filename])
29+
await cachedDelay([__filename])
3030

3131
return (
3232
<div style={{ border: '1px solid blue', padding: '1em' }}>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function ShortLivedCache() {
2626
revalidate: 2 * 60,
2727
expire: 3 * 60, // < DYNAMIC_EXPIRE
2828
})
29-
await cachedDelay(500, [__filename])
29+
await cachedDelay([__filename])
3030

3131
return (
3232
<div style={{ border: '1px solid blue', padding: '1em' }}>

0 commit comments

Comments
 (0)