Skip to content

Commit ee4f245

Browse files
committed
test: adjust assertion for index page cache tags
1 parent ba1d3b3 commit ee4f245

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/integration/simple-app.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import {
3939
nextVersionSatisfies,
4040
shouldHaveAppRouterGlobalErrorInPrerenderManifest,
4141
shouldHaveAppRouterNotFoundInPrerenderManifest,
42+
shouldHaveSlashIndexTagForIndexPage,
4243
} from '../utils/next-version-helpers.mjs'
4344

4445
const mockedCp = cp as Mock<(typeof import('node:fs/promises'))['cp']>
@@ -205,7 +206,11 @@ test<FixtureTestContext>('index should be normalized within the cacheHandler and
205206
await runPlugin(ctx)
206207
const index = await invokeFunction(ctx, { url: '/' })
207208
expect(index.statusCode).toBe(200)
208-
expect(index.headers?.['netlify-cache-tag']).toBe('_N_T_/layout,_N_T_/page,_N_T_/')
209+
expect(index.headers?.['netlify-cache-tag']).toBe(
210+
shouldHaveSlashIndexTagForIndexPage()
211+
? '_N_T_/layout,_N_T_/page,_N_T_/,_N_T_/index'
212+
: '_N_T_/layout,_N_T_/page,_N_T_/',
213+
)
209214
})
210215

211216
// with 15.0.0-canary.187 and later Next.js no longer produce `stale-while-revalidate` directive

tests/utils/next-version-helpers.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export function hasDefaultTurbopackBuilds() {
5353
return nextVersionSatisfies('>=15.6.0-canary.40')
5454
}
5555

56+
export function shouldHaveSlashIndexTagForIndexPage() {
57+
// https://github.com/vercel/next.js/pull/84586
58+
return nextVersionSatisfies('>=v15.6.0-canary.50')
59+
}
60+
5661
/**
5762
* Check if current next version requires React 19
5863
* @param {string} version Next version

0 commit comments

Comments
 (0)