@@ -128,7 +128,9 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
128128 expect ( headers1 [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
129129 expect ( headers1 [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_${ encodeURI ( pagePath ) . toLowerCase ( ) } ` )
130130 expect ( headers1 [ 'netlify-cdn-cache-control' ] ) . toBe (
131- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
131+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
132+ ? 's-maxage=31536000, durable'
133+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
132134 )
133135
134136 const date1 = await page . textContent ( '[data-testid="date-now"]' )
@@ -156,7 +158,9 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
156158 expect ( headers1Json [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
157159 expect ( headers1Json [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_${ encodeURI ( pagePath ) . toLowerCase ( ) } ` )
158160 expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
159- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
161+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
162+ ? 's-maxage=31536000, durable'
163+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
160164 )
161165 const data1 = ( await response1Json ?. json ( ) ) || { }
162166 expect ( data1 ?. pageProps ?. time ) . toBe ( date1 )
@@ -181,7 +185,9 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
181185 expect ( headers2 [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
182186 }
183187 expect ( headers2 [ 'netlify-cdn-cache-control' ] ) . toBe (
184- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
188+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
189+ ? 's-maxage=31536000, durable'
190+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
185191 )
186192
187193 // the page is cached
@@ -212,7 +218,9 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
212218 expect ( headers2Json [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
213219 }
214220 expect ( headers2Json [ 'netlify-cdn-cache-control' ] ) . toBe (
215- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
221+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
222+ ? 's-maxage=31536000, durable'
223+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
216224 )
217225
218226 const data2 = ( await response2Json ?. json ( ) ) || { }
@@ -267,7 +275,9 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
267275 expect ( response3Json ?. status ( ) ) . toBe ( 200 )
268276 expect ( headers3Json [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
269277 expect ( headers3Json [ 'netlify-cdn-cache-control' ] ) . toBe (
270- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
278+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
279+ ? 's-maxage=31536000, durable'
280+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
271281 )
272282
273283 const data3 = ( await response3Json ?. json ( ) ) || { }
@@ -382,7 +392,9 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
382392 expect ( await page . textContent ( 'h1' ) ) . toBe ( '404' )
383393
384394 expect ( headers [ 'netlify-cdn-cache-control' ] ) . toBe (
385- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
395+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
396+ ? 's-maxage=31536000, durable'
397+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
386398 )
387399 expect ( headers [ 'cache-control' ] ) . toBe ( 'public,max-age=0,must-revalidate' )
388400 } )
@@ -532,7 +544,9 @@ test.describe('Page Router with basePath and i18n', () => {
532544 `_n_t_/en${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
533545 )
534546 expect ( headers1ImplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
535- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
547+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
548+ ? 's-maxage=31536000, durable'
549+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
536550 )
537551
538552 const date1ImplicitLocale = await page . textContent ( '[data-testid="date-now"]' )
@@ -560,7 +574,9 @@ test.describe('Page Router with basePath and i18n', () => {
560574 `_n_t_/en${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
561575 )
562576 expect ( headers1ExplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
563- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
577+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
578+ ? 's-maxage=31536000, durable'
579+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
564580 )
565581
566582 const date1ExplicitLocale = await page . textContent ( '[data-testid="date-now"]' )
@@ -594,7 +610,9 @@ test.describe('Page Router with basePath and i18n', () => {
594610 `_n_t_/en${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
595611 )
596612 expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
597- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
613+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
614+ ? 's-maxage=31536000, durable'
615+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
598616 )
599617 const data1 = ( await response1Json ?. json ( ) ) || { }
600618 expect ( data1 ?. pageProps ?. time ) . toBe ( date1ImplicitLocale )
@@ -622,7 +640,9 @@ test.describe('Page Router with basePath and i18n', () => {
622640 expect ( headers2ImplicitLocale [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
623641 }
624642 expect ( headers2ImplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
625- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
643+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
644+ ? 's-maxage=31536000, durable'
645+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
626646 )
627647
628648 // the page is cached
@@ -652,7 +672,9 @@ test.describe('Page Router with basePath and i18n', () => {
652672 expect ( headers2ExplicitLocale [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
653673 }
654674 expect ( headers2ExplicitLocale [ 'netlify-cdn-cache-control' ] ) . toBe (
655- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
675+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
676+ ? 's-maxage=31536000, durable'
677+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
656678 )
657679
658680 // the page is cached
@@ -683,7 +705,9 @@ test.describe('Page Router with basePath and i18n', () => {
683705 expect ( headers2Json [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
684706 }
685707 expect ( headers2Json [ 'netlify-cdn-cache-control' ] ) . toBe (
686- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
708+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
709+ ? 's-maxage=31536000, durable'
710+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
687711 )
688712
689713 const data2 = ( await response2Json ?. json ( ) ) || { }
@@ -777,7 +801,9 @@ test.describe('Page Router with basePath and i18n', () => {
777801 expect ( headers3Json [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
778802 }
779803 expect ( headers3Json [ 'netlify-cdn-cache-control' ] ) . toBe (
780- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
804+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
805+ ? 's-maxage=31536000, durable'
806+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
781807 )
782808
783809 const data3 = ( await response3Json ?. json ( ) ) || { }
@@ -866,7 +892,9 @@ test.describe('Page Router with basePath and i18n', () => {
866892 expect ( response4Json ?. status ( ) ) . toBe ( 200 )
867893 expect ( headers4Json [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
868894 expect ( headers4Json [ 'netlify-cdn-cache-control' ] ) . toBe (
869- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
895+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
896+ ? 's-maxage=31536000, durable'
897+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
870898 )
871899
872900 const data4 = ( await response4Json ?. json ( ) ) || { }
@@ -912,7 +940,9 @@ test.describe('Page Router with basePath and i18n', () => {
912940 expect ( headers1 [ 'x-nextjs-cache' ] ) . toBeUndefined ( )
913941 expect ( headers1 [ 'netlify-cache-tag' ] ) . toBe ( `_n_t_/de${ encodeURI ( pagePath ) . toLowerCase ( ) } ` )
914942 expect ( headers1 [ 'netlify-cdn-cache-control' ] ) . toBe (
915- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
943+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
944+ ? 's-maxage=31536000, durable'
945+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
916946 )
917947
918948 const date1 = await page . textContent ( '[data-testid="date-now"]' )
@@ -943,7 +973,9 @@ test.describe('Page Router with basePath and i18n', () => {
943973 `_n_t_/de${ encodeURI ( pagePath ) . toLowerCase ( ) } ` ,
944974 )
945975 expect ( headers1Json [ 'netlify-cdn-cache-control' ] ) . toBe (
946- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
976+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
977+ ? 's-maxage=31536000, durable'
978+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
947979 )
948980 const data1 = ( await response1Json ?. json ( ) ) || { }
949981 expect ( data1 ?. pageProps ?. time ) . toBe ( date1 )
@@ -971,7 +1003,9 @@ test.describe('Page Router with basePath and i18n', () => {
9711003 expect ( headers2 [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
9721004 }
9731005 expect ( headers2 [ 'netlify-cdn-cache-control' ] ) . toBe (
974- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
1006+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
1007+ ? 's-maxage=31536000, durable'
1008+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
9751009 )
9761010
9771011 // the page is cached
@@ -1003,7 +1037,9 @@ test.describe('Page Router with basePath and i18n', () => {
10031037 expect ( headers2Json [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
10041038 }
10051039 expect ( headers2Json [ 'netlify-cdn-cache-control' ] ) . toBe (
1006- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
1040+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
1041+ ? 's-maxage=31536000, durable'
1042+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
10071043 )
10081044
10091045 const data2 = ( await response2Json ?. json ( ) ) || { }
@@ -1070,7 +1106,9 @@ test.describe('Page Router with basePath and i18n', () => {
10701106 expect ( headers3Json [ 'cache-status' ] ) . toMatch ( / " N e x t .j s " ; h i t / m)
10711107 }
10721108 expect ( headers3Json [ 'netlify-cdn-cache-control' ] ) . toBe (
1073- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
1109+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
1110+ ? 's-maxage=31536000, durable'
1111+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
10741112 )
10751113
10761114 const data3 = ( await response3Json ?. json ( ) ) || { }
@@ -1114,7 +1152,9 @@ test.describe('Page Router with basePath and i18n', () => {
11141152 expect ( await page . textContent ( 'h1' ) ) . toBe ( '404' )
11151153
11161154 expect ( headers [ 'netlify-cdn-cache-control' ] ) . toBe (
1117- 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
1155+ nextVersionSatisfies ( '>=15.0.0-canary.187' )
1156+ ? 's-maxage=31536000, durable'
1157+ : 's-maxage=31536000, stale-while-revalidate=31536000, durable' ,
11181158 )
11191159 expect ( headers [ 'cache-control' ] ) . toBe ( 'public,max-age=0,must-revalidate' )
11201160 } )
0 commit comments