silverwolf-x/project / test /production /app-dir /use-cache-non-deterministic-args /use-cache-non-deterministic-args.test.ts
silverwolf-x's picture
download
raw
1.67 kB
import { nextTestSetup } from 'e2e-utils'
describe('use-cache-non-deterministic-args', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should warn about non-deterministic cache args during on-demand prerender', async () => {
const outputIndex = next.cliOutput.length
await next.browser('/unknown')
const output = next.cliOutput.slice(outputIndex)
expect(output).not.toContain('Connection closed')
expect(output).toContain(
'Unexpected cache miss after cache warming phase during prerendering'
)
})
it('should warn about non-deterministic cache args during runtime prefetch', async () => {
const outputIndex = next.cliOutput.length
let onRuntimePrefetchDone: () => void
const runtimePrefetchDone = new Promise<void>((resolve) => {
onRuntimePrefetchDone = resolve
})
// Visit /with-runtime-prefetch to render the Link. The link being visible
// in the viewport triggers a runtime prefetch for the /known route.
await next.browser('/with-runtime-prefetch', {
beforePageLoad(page) {
page.on('response', (res) => {
const url = new URL(res.url())
const request = res.request()
if (
url.pathname === '/known' &&
request.headers()['next-router-prefetch'] === '2'
) {
onRuntimePrefetchDone()
}
})
},
})
await runtimePrefetchDone
const output = next.cliOutput.slice(outputIndex)
expect(output).not.toContain('Connection closed')
expect(output).toContain(
'Unexpected cache miss after cache warming phase during prerendering'
)
})
})

Xet Storage Details

Size:
1.67 kB
·
Xet hash:
51b6ed77d245aff0b0807cdeaeb874e833a61159a9c5a0a11170225a3b3cbd22

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.