Skip to content

Commit 1aee505

Browse files
committed
test: older versions of next have different cache headers
1 parent e95639a commit 1aee505

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/e2e/dynamic-cms.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ test.describe('Dynamic CMS', () => {
1313
'"Next.js"; fwd=miss, "Netlify Durable"; fwd=uri-miss; stored, "Netlify Edge"; fwd=miss',
1414
)
1515
expect(headers1['netlify-cache-tag']).toEqual('_n_t_/content/blog')
16-
expect(headers1['netlify-cdn-cache-control']).toEqual('s-maxage=31536000, durable')
16+
expect(headers1['netlify-cdn-cache-control']).toMatch(
17+
/s-maxage=31536000,( stale-while-revalidate=31536000,)? durable/
18+
)
1719

1820
// 2. Publish the blob, revalidate the dynamic page, and wait to regenerate
1921
await page.goto(new URL('/cms/publish', dynamicCms.url).href)
@@ -30,7 +32,9 @@ test.describe('Dynamic CMS', () => {
3032
/"Next.js"; hit, "Netlify Durable"; fwd=stale; ttl=[0-9]+; stored, "Netlify Edge"; fwd=stale/,
3133
)
3234
expect(headers2['netlify-cache-tag']).toEqual('_n_t_/content/blog')
33-
expect(headers2['netlify-cdn-cache-control']).toEqual('s-maxage=31536000, durable')
35+
expect(headers2['netlify-cdn-cache-control']).toMatch(
36+
/s-maxage=31536000,( stale-while-revalidate=31536000,)? durable/
37+
)
3438

3539
// 4. Unpublish the blob, revalidate the dynamic page, and wait to regenerate
3640
await page.goto(new URL('/cms/unpublish', dynamicCms.url).href)
@@ -47,6 +51,8 @@ test.describe('Dynamic CMS', () => {
4751
/"Next.js"; fwd=miss, "Netlify Durable"; fwd=stale; ttl=[0-9]+; stored, "Netlify Edge"; fwd=stale/,
4852
)
4953
expect(headers3['netlify-cache-tag']).toEqual('_n_t_/content/blog')
50-
expect(headers3['netlify-cdn-cache-control']).toEqual('s-maxage=31536000, durable')
54+
expect(headers3['netlify-cdn-cache-control']).toMatch(
55+
/s-maxage=31536000,( stale-while-revalidate=31536000,)? durable/
56+
)
5157
})
5258
})

0 commit comments

Comments
 (0)