@@ -9,42 +9,24 @@ jest.useFakeTimers('legacy')
99describe ( 'developer.github.com redirects' , ( ) => {
1010 jest . setTimeout ( 30 * 60 * 1000 )
1111
12- it ( 'responds with 200 for the top historical request paths' , async ( ) => {
13- // ignore paths that are not (yet?) being redirected from developer.github.com to docs.github.com
14- const ignoredPatterns = [
15- / ^ \/ c h a n g e s / ,
16- '/forum' , // can be top-level or nest under a GHE route
17- / ^ \/ p a r t n e r s h i p s / ,
18- '2.17' ,
19- '2.16' ,
20- '2.15' ,
21- ]
22-
23- // test a subset of the top paths
24- const pathsToCheck = 50
25- const paths = topOldDeveloperSitePaths
26- . filter ( ( path ) => ! ignoredPatterns . some ( ( pattern ) => path . match ( pattern ) ) )
27- . slice ( 0 , pathsToCheck )
28-
29- const non200s = [ ]
30-
31- for ( const path of paths ) {
32- const { statusCode } = await head ( path , { followRedirects : true } )
33- if ( statusCode !== 200 ) {
34- non200s . push ( path )
35- }
36- }
37-
38- // generate an object with empty values as the error message
39- const errorMessage = JSON . stringify (
40- non200s . reduce ( ( acc , path ) => {
41- acc [ path ] = ''
42- return acc
43- } , { } ) ,
44- null ,
45- 2
46- )
47-
48- expect ( non200s , errorMessage ) . toEqual ( [ ] )
12+ // ignore paths that are not (yet?) being redirected from developer.github.com to docs.github.com
13+ const ignoredPatterns = [
14+ / ^ \/ c h a n g e s / ,
15+ '/forum' , // can be top-level or nest under a GHE route
16+ / ^ \/ p a r t n e r s h i p s / ,
17+ '2.17' ,
18+ '2.16' ,
19+ '2.15' ,
20+ ]
21+
22+ // test a subset of the top paths
23+ const pathsToCheck = 50
24+ const paths = topOldDeveloperSitePaths
25+ . filter ( ( path ) => ! ignoredPatterns . some ( ( pattern ) => path . match ( pattern ) ) )
26+ . slice ( 0 , pathsToCheck )
27+
28+ test . each ( paths ) ( 'responds with 200 on %p' , async ( path ) => {
29+ const { statusCode } = await head ( path , { followRedirects : true } )
30+ expect ( statusCode ) . toEqual ( 200 )
4931 } )
5032} )
0 commit comments