@@ -48,8 +48,7 @@ function getClientStub(hostname) {
4848 page : {
4949 id : 103 ,
5050 title : "Testing" ,
51- content :
52- "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
51+ content : "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
5352 metadata : { header : true , footer : false } ,
5453 type : "static-page" ,
5554 "status-code" : 200 ,
@@ -60,8 +59,7 @@ function getClientStub(hostname) {
6059 page : {
6160 id : 104 ,
6261 title : "Testing" ,
63- content :
64- "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
62+ content : "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
6563 metadata : { header : false , footer : false } ,
6664 type : "static-page" ,
6765 "status-code" : 200 ,
@@ -72,8 +70,7 @@ function getClientStub(hostname) {
7270 page : {
7371 id : 105 ,
7472 title : "Testing mime type" ,
75- content :
76- "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
73+ content : "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
7774 metadata : {
7875 header : false ,
7976 footer : false ,
@@ -104,9 +101,7 @@ function createApp(loadData, routes, opts = {}) {
104101 generateRoutes : ( ) => routes ,
105102 loadData,
106103 renderLayout : ( res , { contentTemplate, store } ) =>
107- res . send (
108- JSON . stringify ( { contentTemplate, store : store . getState ( ) } )
109- ) ,
104+ res . send ( JSON . stringify ( { contentTemplate, store : store . getState ( ) } ) ) ,
110105 handleNotFound : false ,
111106 publisherConfig : { } ,
112107 } ,
@@ -126,10 +121,7 @@ describe("Custom Route Handler", function () {
126121 supertest ( app )
127122 . get ( "/moved-permanently" )
128123 . expect ( "Location" , "/permanent-location" )
129- . expect (
130- "Cache-Control" ,
131- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
132- )
124+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
133125 . expect ( "Vary" , / A c c e p t \- E n c o d i n g / )
134126 . expect ( "Surrogate-Key" , "sp/42/101" )
135127 . expect ( "Cache-Tag" , "sp/42/101" )
@@ -144,10 +136,7 @@ describe("Custom Route Handler", function () {
144136 supertest ( app )
145137 . get ( "/moved-temporarily" )
146138 . expect ( "Location" , "/temporary-location" )
147- . expect (
148- "Cache-Control" ,
149- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
150- )
139+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
151140 . expect ( "Vary" , / A c c e p t \- E n c o d i n g / )
152141 . expect ( "Surrogate-Key" , "sp/42/102" )
153142 . expect ( "Cache-Tag" , "sp/42/102" )
@@ -163,10 +152,7 @@ describe("Custom Route Handler", function () {
163152 supertest ( app )
164153 . get ( "/static-with-header-footer" )
165154 . expect ( "Content-Type" , / h t m l / )
166- . expect (
167- "Cache-Control" ,
168- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
169- )
155+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
170156 . expect ( "Vary" , "Accept-Encoding" )
171157 . expect ( "Surrogate-Key" , "sp/42/103" )
172158 . expect ( "Cache-Tag" , "sp/42/103" )
@@ -188,19 +174,13 @@ describe("Custom Route Handler", function () {
188174 supertest ( app )
189175 . get ( "/static-without-header-footer" )
190176 . expect ( "Content-Type" , / h t m l / )
191- . expect (
192- "Cache-Control" ,
193- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
194- )
177+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
195178 . expect ( "Vary" , "Accept-Encoding" )
196179 . expect ( "Surrogate-Key" , "sp/42/104" )
197180 . expect ( "Cache-Tag" , "sp/42/104" )
198181 . expect ( 200 )
199182 . then ( ( res ) => {
200- assert . equal (
201- "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" ,
202- res . text
203- ) ;
183+ assert . equal ( "<html><head><title>Test</title></head><body><h1>Heading</h1></body></html>" , res . text ) ;
204184 } )
205185 . then ( done ) ;
206186 } ) ;
@@ -233,9 +213,7 @@ describe("Custom Route Handler", function () {
233213 it ( "Store reads config and data from data-loader response" , function ( done ) {
234214 const app = createApp (
235215 ( pageType , params , config , client , { host, next } ) =>
236- pageType === "custom-static-page"
237- ? Promise . resolve ( { data : { navigationMenu : [ ] } , config : { } } )
238- : next ( ) ,
216+ pageType === "custom-static-page" ? Promise . resolve ( { data : { navigationMenu : [ ] } , config : { } } ) : next ( ) ,
239217 [ { pageType : "story-page" , path : "/*" } ]
240218 ) ;
241219 supertest ( app )
@@ -258,10 +236,7 @@ describe("Custom Route Handler", function () {
258236 supertest ( app )
259237 . get ( "/moved-absolute" )
260238 . expect ( "Location" , "https://www.google.com" )
261- . expect (
262- "Cache-Control" ,
263- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
264- )
239+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
265240 . expect ( "Vary" , / A c c e p t \- E n c o d i n g / )
266241 . expect ( "Surrogate-Key" , "sp/42/105" )
267242 . expect ( "Cache-Tag" , "sp/42/105" )
@@ -275,10 +250,7 @@ describe("Custom Route Handler", function () {
275250 ) ;
276251 supertest ( app )
277252 . get ( "/static-with-mime-type" )
278- . expect (
279- "Cache-Control" ,
280- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
281- )
253+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
282254 . expect ( "Vary" , / A c c e p t \- E n c o d i n g / )
283255 . expect ( "Surrogate-Key" , "sp/42/105" )
284256 . expect ( "Cache-Tag" , "sp/42/105" )
@@ -293,10 +265,7 @@ describe("Custom Route Handler", function () {
293265 ) ;
294266 supertest ( app )
295267 . get ( "/static-without-header-footer" )
296- . expect (
297- "Cache-Control" ,
298- "public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
299- )
268+ . expect ( "Cache-Control" , "public,max-age=15,s-maxage=120,stale-while-revalidate=120,stale-if-error=120" )
300269 . expect ( "Vary" , "Accept-Encoding" )
301270 . expect ( "Surrogate-Key" , "sp/42/104" )
302271 . expect ( "Cache-Tag" , "sp/42/104" )
0 commit comments