Unverified Commit f6298ede authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

Use waitFor in static fallback prefetch tests

Co-authored-by: 's avatarWill Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
parent 9148c2d9
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { waitFor } from 'next-test-utils'
import { PrefetchHint } from 'next/src/shared/lib/app-router-types' import { PrefetchHint } from 'next/src/shared/lib/app-router-types'
import { createRouterAct } from 'router-act' import { createRouterAct } from 'router-act'
...@@ -182,7 +183,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -182,7 +183,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
'no-requests' 'no-requests'
) )
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => setTimeout(resolve, ISR_RETRY_DELAY)) await waitFor(ISR_RETRY_DELAY)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
...@@ -246,7 +247,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -246,7 +247,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
}, },
]) ])
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => setTimeout(resolve, ISR_RETRY_DELAY)) await waitFor(ISR_RETRY_DELAY)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
...@@ -315,9 +316,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -315,9 +316,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
}, },
]) ])
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => await waitFor(ISR_RETRY_DELAY)
setTimeout(resolve, ISR_RETRY_DELAY)
)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
...@@ -387,9 +386,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -387,9 +386,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
}, },
]) ])
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => await waitFor(ISR_RETRY_DELAY)
setTimeout(resolve, ISR_RETRY_DELAY)
)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
...@@ -461,7 +458,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -461,7 +458,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
) )
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => setTimeout(resolve, ISR_RETRY_DELAY)) await waitFor(ISR_RETRY_DELAY)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
...@@ -529,7 +526,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -529,7 +526,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
}, },
]) ])
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => setTimeout(resolve, ISR_RETRY_DELAY)) await waitFor(ISR_RETRY_DELAY)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
// It also says that the route needs a runtime prefetch (because it used // It also says that the route needs a runtime prefetch (because it used
...@@ -599,9 +596,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -599,9 +596,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
}, },
]) ])
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => await waitFor(ISR_RETRY_DELAY)
setTimeout(resolve, ISR_RETRY_DELAY)
)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
...@@ -671,9 +666,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => { ...@@ -671,9 +666,7 @@ describe('Partial prefetching with static params and ISR fallbacks', () => {
}, },
]) ])
// Wait for the router to do a retry. // Wait for the router to do a retry.
await new Promise((resolve) => await waitFor(ISR_RETRY_DELAY)
setTimeout(resolve, ISR_RETRY_DELAY)
)
}, [ }, [
// The retried request yields a concrete prerender with params. // The retried request yields a concrete prerender with params.
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment