Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4cc0bc2

Browse files
authored
Revert "test: adjust page-router i18n tests for next 13 (#3107)"
This reverts commit 85cb5d5.
1 parent 8cd51b5 commit 4cc0bc2

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

tests/e2e/page-router.test.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,10 +1392,17 @@ test.describe('Page Router with basePath and i18n', () => {
13921392

13931393
expect(await page.textContent('p')).toBe('Custom 404 page for locale: en')
13941394

1395-
expect(headers['debug-netlify-cdn-cache-control']).toMatch(
1396-
/no-cache, no-store, max-age=0, must-revalidate, durable/m,
1395+
// https://github.com/vercel/next.js/pull/69802 made changes to returned cache-control header,
1396+
// after that 404 pages would have `private` directive, before that it would not
1397+
const shouldHavePrivateDirective = nextVersionSatisfies('^14.2.10 || >=15.0.0-canary.147')
1398+
expect(headers['debug-netlify-cdn-cache-control']).toBe(
1399+
(shouldHavePrivateDirective ? 'private, ' : '') +
1400+
'no-cache, no-store, max-age=0, must-revalidate, durable',
1401+
)
1402+
expect(headers['cache-control']).toBe(
1403+
(shouldHavePrivateDirective ? 'private,' : '') +
1404+
'no-cache,no-store,max-age=0,must-revalidate',
13971405
)
1398-
expect(headers['cache-control']).toMatch(/no-cache,no-store,max-age=0,must-revalidate/m)
13991406
})
14001407

14011408
test('requesting a non existing page route that needs to be fetched from the blob store like 404.html (notFound: true)', async ({
@@ -1410,16 +1417,12 @@ test.describe('Page Router with basePath and i18n', () => {
14101417

14111418
expect(await page.textContent('p')).toBe('Custom 404 page for locale: en')
14121419

1413-
// Prior to v14.2.4 notFound pages are not cacheable
1414-
// https://github.com/vercel/next.js/pull/66674
1415-
if (nextVersionSatisfies('>= 14.2.4')) {
1416-
expect(headers['debug-netlify-cdn-cache-control']).toBe(
1417-
nextVersionSatisfies('>=15.0.0-canary.187')
1418-
? 's-maxage=31536000, durable'
1419-
: 's-maxage=31536000, stale-while-revalidate=31536000, durable',
1420-
)
1421-
expect(headers['cache-control']).toBe('public,max-age=0,must-revalidate')
1422-
}
1420+
expect(headers['debug-netlify-cdn-cache-control']).toBe(
1421+
nextVersionSatisfies('>=15.0.0-canary.187')
1422+
? 's-maxage=31536000, durable'
1423+
: 's-maxage=31536000, stale-while-revalidate=31536000, durable',
1424+
)
1425+
expect(headers['cache-control']).toBe('public,max-age=0,must-revalidate')
14231426
})
14241427

14251428
test.describe('static assets and function invocations', () => {

0 commit comments

Comments
 (0)