@@ -77,22 +77,20 @@ describe('Test auth', () => {
7777 describe ( 'getCacheControlRules' , ( ) => {
7878 it ( 'returns one rule per unique host' , ( ) => {
7979 const configs = [
80- { host : 'prod.example.com' , previewHost : 'preview.example.com' } ,
80+ { host : 'prod.example.com' } ,
8181 { liveHost : 'live.example.com' } ,
8282 ] ;
8383 const rules = getCacheControlRules ( configs ) ;
84- expect ( rules ) . to . have . lengthOf ( 3 ) ;
84+ expect ( rules ) . to . have . lengthOf ( 2 ) ;
8585 expect ( rules . every ( ( r ) => r . action ?. responseHeaders ?. [ 0 ] ?. header === 'Cache-Control' ) ) . to . be . true ;
86- expect ( rules . every ( ( r ) => r . action . responseHeaders [ 0 ] . value === `max-age=${ CACHE_MAX_AGE_SECONDS } ` ) ) . to . be . true ;
86+ expect ( rules . every ( ( r ) => r . action . responseHeaders [ 0 ] . value === `max-age=${ CACHE_MAX_AGE_SECONDS } , must-revalidate ` ) ) . to . be . true ;
8787 const filters = rules . map ( ( r ) => r . condition . regexFilter ) ;
8888 expect ( filters ) . to . include ( '^https://prod\\.example\\.com/.*' ) ;
89- expect ( filters ) . to . include ( '^https://preview\\.example\\.com/.*' ) ;
9089 expect ( filters ) . to . include ( '^https://live\\.example\\.com/.*' ) ;
9190 } ) ;
9291 it ( 'deduplicates same host across configs' , ( ) => {
9392 const configs = [
94- { host : 'same.com' , previewHost : 'same.com' } ,
95- { liveHost : 'same.com' } ,
93+ { host : 'same.com' , liveHost : 'same.com' } ,
9694 ] ;
9795 const rules = getCacheControlRules ( configs ) ;
9896 expect ( rules ) . to . have . lengthOf ( 1 ) ;
@@ -106,7 +104,7 @@ describe('Test auth', () => {
106104 } ) ;
107105 it ( 'returns empty array for empty or no valid hosts' , ( ) => {
108106 expect ( getCacheControlRules ( [ ] ) ) . to . deep . equal ( [ ] ) ;
109- expect ( getCacheControlRules ( [ { host : '' } , { previewHost : null } ] ) ) . to . deep . equal ( [ ] ) ;
107+ expect ( getCacheControlRules ( [ { host : '' } , { liveHost : null } ] ) ) . to . deep . equal ( [ ] ) ;
110108 } ) ;
111109 } ) ;
112110
0 commit comments