Skip to content

Commit af10944

Browse files
authored
test: adjust tests for [email protected] (#582)
* chore: run baseline * test: adjust cache-control assertion for 404 page based on next version
1 parent f745269 commit af10944

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: tests/e2e/simple-app.test.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,17 @@ test('requesting a non existing page route that needs to be fetched from the blo
214214

215215
expect(await page.textContent('h1')).toBe('404 Not Found')
216216

217+
// https://github.com/vercel/next.js/pull/66674 made changes to returned cache-control header,
218+
// before that 404 page would have `private` directive, after that it would not
219+
const shouldHavePrivateDirective = !nextVersionSatisfies('>=14.2.4 <15.0.0 || >=15.0.0-canary.24')
220+
217221
expect(headers['netlify-cdn-cache-control']).toBe(
218-
'private, no-cache, no-store, max-age=0, must-revalidate',
222+
(shouldHavePrivateDirective ? 'private, ' : '') +
223+
'no-cache, no-store, max-age=0, must-revalidate',
224+
)
225+
expect(headers['cache-control']).toBe(
226+
(shouldHavePrivateDirective ? 'private,' : '') + 'no-cache,no-store,max-age=0,must-revalidate',
219227
)
220-
expect(headers['cache-control']).toBe('private,no-cache,no-store,max-age=0,must-revalidate')
221228
})
222229

223230
test('requesting a non existing page route that needs to be fetched from the blob store like 404.html (notFound())', async ({

0 commit comments

Comments
 (0)