@@ -609,6 +609,8 @@ describe('server', () => {
609609 test ( 'redirects old articles to their English URL' , async ( ) => {
610610 const res = await get ( '/articles/deleting-a-team' )
611611 expect ( res . statusCode ) . toBe ( 301 )
612+ // no cache control because a language prefix had to be injected
613+ expect ( res . headers [ 'cache-control' ] ) . toBeUndefined ( )
612614 } )
613615
614616 test ( 'redirects old articles to their slugified URL' , async ( ) => {
@@ -629,12 +631,21 @@ describe('server', () => {
629631 const res = await get ( '/articles/deleting-a-team' )
630632 expect ( res . statusCode ) . toBe ( 301 )
631633 expect ( res . headers . location . startsWith ( '/en/' ) ) . toBe ( true )
634+ expect ( res . headers [ 'cache-control' ] ) . toBeUndefined ( )
635+ } )
636+
637+ test ( 'redirects that not only injects /en/ should have cache-control' , async ( ) => {
638+ const res = await get ( '/en/articles/deleting-a-team' )
639+ expect ( res . statusCode ) . toBe ( 301 )
640+ expect ( res . headers [ 'cache-control' ] ) . toContain ( 'public' )
641+ expect ( res . headers [ 'cache-control' ] ) . toMatch ( / m a x - a g e = \d + / )
632642 } )
633643
634644 test ( 'redirects Desktop Classic paths to desktop.github.com' , async ( ) => {
635645 const res = await get ( '/desktop-classic' )
636646 expect ( res . statusCode ) . toBe ( 301 )
637647 expect ( res . headers . location ) . toBe ( 'https://desktop.github.com' )
648+ expect ( res . headers [ 'cache-control' ] ) . toBeUndefined ( )
638649 } )
639650
640651 // this oneoff redirect is temporarily disabled because it introduces too much complexity
@@ -646,6 +657,8 @@ describe('server', () => {
646657 expect ( res . headers . location ) . toBe (
647658 '/en/github/managing-subscriptions-and-notifications-on-github'
648659 )
660+ expect ( res . headers [ 'cache-control' ] ) . toContain ( 'public' )
661+ expect ( res . headers [ 'cache-control' ] ) . toMatch ( / m a x - a g e = \d + / )
649662 } )
650663 } )
651664
0 commit comments