Unverified Commit 75a8303f authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Add unstable_cache validate test case (#59828)

Follow-up to https://github.com/vercel/next.js/pull/59822 adding an
additional test case.

Closes NEXT-1918
parent 8a1717cb
...@@ -74,5 +74,27 @@ createNextDescribe( ...@@ -74,5 +74,27 @@ createNextDescribe(
await next.patchFile('app/page.tsx', origText) await next.patchFile('app/page.tsx', origText)
} }
}) })
it('should error properly for invalid revalidate on unstable_cache', async () => {
await next.stop().catch(() => {})
const origText = await next.readFile('app/page.tsx')
try {
await next.patchFile(
'app/page.tsx',
origText.replace('// await unstable', 'await unstable')
)
await next.start().catch(() => {})
await check(async () => {
if (isNextDev) {
await next.fetch('/')
}
return next.cliOutput
}, /Invalid revalidate value "1" on "unstable_cache/)
} finally {
await next.patchFile('app/page.tsx', origText)
}
})
} }
) )
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { unstable_cache } from 'next/cache'
// export const revalidate = '1' // export const revalidate = '1'
export default async function Page() { export default async function Page() {
// await fetch('https://example.vercel.sh', { next: { revalidate: '1' } }) // await fetch('https://example.vercel.sh', { next: { revalidate: '1' } })
// await unstable_cache(async () => Date.now(), [], { revalidate: '1' })()
return <p>hello world</p> return <p>hello world</p>
} }
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