Skip to content

Commit ccf2788

Browse files
committed
test: adjust cache-status assertions for stale responses serverd by durable
1 parent 27a82bd commit ccf2788

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/e2e/page-router.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,12 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
413413
expect(date1.localeCompare(beforeFirstFetch)).toBeGreaterThan(0)
414414

415415
// allow page to get stale
416-
await page.waitForTimeout(60_000)
416+
await page.waitForTimeout(61_000)
417417

418418
const response2 = await page.goto(new URL(pathname, pageRouter.url).href)
419419
expect(response2?.status()).toBe(200)
420420
expect(response2?.headers()['cache-status']).toMatch(
421-
/"Netlify (Edge|Durable)"; hit; fwd=stale/m,
421+
/("Netlify Edge"; hit; fwd=stale|"Netlify Durable"; hit; ttl=-[0-9]+)/m,
422422
)
423423
expect(response2?.headers()['netlify-cdn-cache-control']).toMatch(
424424
/s-maxage=60, stale-while-revalidate=[0-9]+, durable/,
@@ -436,8 +436,8 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
436436
const response3 = await page.goto(new URL(pathname, pageRouter.url).href)
437437
expect(response3?.status()).toBe(200)
438438
expect(response3?.headers()['cache-status']).toMatch(
439-
// hit, without being followed by ';fwd=stale'
440-
/"Netlify (Edge|Durable)"; hit(?!; fwd=stale)/m,
439+
// hit, without being followed by ';fwd=stale' for edge or negative TTL for durable, optionally with fwd=stale
440+
/("Netlify Edge"; hit(?!; fwd=stale)|"Netlify Durable"; hit(?!; ttl=-[0-9]+))/m,
441441
)
442442
expect(response3?.headers()['netlify-cdn-cache-control']).toMatch(
443443
/s-maxage=60, stale-while-revalidate=[0-9]+, durable/,

0 commit comments

Comments
 (0)