@@ -55,7 +55,7 @@ describe('page router', () => {
55
55
expect ( load ( call1 . body ) ( 'h1' ) . text ( ) ) . toBe ( 'Show #71' )
56
56
expect ( call1 . headers , 'a cache hit on the first invocation of a prerendered page' ) . toEqual (
57
57
expect . objectContaining ( {
58
- 'x-nextjs- cache' : 'HIT' ,
58
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
59
59
'netlify-cdn-cache-control' : 's-maxage=5, stale-while-revalidate=31536000' ,
60
60
} ) ,
61
61
)
@@ -72,7 +72,7 @@ describe('page router', () => {
72
72
expect ( call2 . statusCode ) . toBe ( 200 )
73
73
expect ( call2 . headers , 'a cache miss on a stale page' ) . toEqual (
74
74
expect . objectContaining ( {
75
- 'x-nextjs- cache' : 'MISS' ,
75
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; m i s s / ) ,
76
76
} ) ,
77
77
)
78
78
expect ( call2Date , 'the date was cached and is matching the initial one' ) . not . toBe ( call1Date )
@@ -84,7 +84,7 @@ describe('page router', () => {
84
84
85
85
expect ( callLater2 . headers , 'date header matches the cached value' ) . toEqual (
86
86
expect . objectContaining ( {
87
- 'x-nextjs- cache' : 'HIT' ,
87
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
88
88
date : callLater . headers [ 'date' ] ,
89
89
} ) ,
90
90
)
@@ -99,7 +99,7 @@ describe('page router', () => {
99
99
expect ( call3 . statusCode ) . toBe ( 200 )
100
100
expect ( call3 . headers , 'a cache hit after dynamically regenerating the stale page' ) . toEqual (
101
101
expect . objectContaining ( {
102
- 'x-nextjs- cache' : 'HIT' ,
102
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
103
103
} ) ,
104
104
)
105
105
} )
@@ -131,7 +131,7 @@ describe('app router', () => {
131
131
expect ( load ( post1 . body ) ( 'h1' ) . text ( ) ) . toBe ( 'Revalidate Fetch' )
132
132
expect ( post1 . headers , 'a cache hit on the first invocation of a prerendered page' ) . toEqual (
133
133
expect . objectContaining ( {
134
- 'x-nextjs- cache' : 'HIT' ,
134
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
135
135
'netlify-cdn-cache-control' : 's-maxage=5, stale-while-revalidate=31536000' ,
136
136
} ) ,
137
137
)
@@ -143,7 +143,7 @@ describe('app router', () => {
143
143
expect ( load ( post3 . body ) ( 'h1' ) . text ( ) ) . toBe ( 'Revalidate Fetch' )
144
144
expect ( post3 . headers , 'a cache miss on a non prerendered page' ) . toEqual (
145
145
expect . objectContaining ( {
146
- 'x-nextjs- cache' : 'MISS' ,
146
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; m i s s / ) ,
147
147
} ) ,
148
148
)
149
149
@@ -157,7 +157,7 @@ describe('app router', () => {
157
157
expect ( stale . statusCode ) . toBe ( 200 )
158
158
expect ( stale . headers , 'a cache miss on a stale page' ) . toEqual (
159
159
expect . objectContaining ( {
160
- 'x-nextjs- cache' : 'MISS' ,
160
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; m i s s / ) ,
161
161
} ) ,
162
162
)
163
163
// it should have a new date rendered
@@ -173,7 +173,7 @@ describe('app router', () => {
173
173
expect ( staleDate , 'the date was not cached' ) . toBe ( cachedDate )
174
174
expect ( cached . headers , 'a cache hit after dynamically regenerating the stale page' ) . toEqual (
175
175
expect . objectContaining ( {
176
- 'x-nextjs- cache' : 'HIT' ,
176
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
177
177
} ) ,
178
178
)
179
179
} )
@@ -228,7 +228,7 @@ describe('route', () => {
228
228
} )
229
229
expect ( call1 . headers , 'a cache hit on the first invocation of a prerendered route' ) . toEqual (
230
230
expect . objectContaining ( {
231
- 'x-nextjs- cache' : 'HIT' ,
231
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
232
232
} ) ,
233
233
)
234
234
// wait to have a stale route
@@ -242,7 +242,7 @@ describe('route', () => {
242
242
expect ( call2Body ) . toMatchObject ( { data : expect . objectContaining ( { id : 1 } ) } )
243
243
expect ( call2 . headers , 'a cache miss on a stale route' ) . toEqual (
244
244
expect . objectContaining ( {
245
- 'x-nextjs- cache' : 'MISS' ,
245
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; m i s s / ) ,
246
246
} ) ,
247
247
)
248
248
expect ( call1Time , 'the date is a new one on a stale route' ) . not . toBe ( call2Time )
@@ -257,7 +257,7 @@ describe('route', () => {
257
257
expect ( call3Body ) . toMatchObject ( { data : expect . objectContaining ( { id : 1 } ) } )
258
258
expect ( call3 . headers , 'a cache hit after dynamically regenerating the stale route' ) . toEqual (
259
259
expect . objectContaining ( {
260
- 'x-nextjs- cache' : 'HIT' ,
260
+ 'cache-status ' : expect . stringMatching ( / " N e x t . j s " ; h i t / ) ,
261
261
} ) ,
262
262
)
263
263
expect ( call3Time , 'the date was cached as well' ) . toBe ( call2Time )
0 commit comments