@@ -3,8 +3,6 @@ const robotsParser = require('robots-parser')
33const robotsMiddleware = require ( '../../middleware/robots' )
44const { get } = require ( '../helpers/supertest' )
55const MockExpressResponse = require ( 'mock-express-response' )
6- const products = require ( '../../lib/all-products' )
7- const enterpriseServerReleases = require ( '../../lib/enterprise-server-releases' )
86
97describe ( 'robots.txt' , ( ) => {
108 jest . setTimeout ( 5 * 60 * 1000 )
@@ -31,15 +29,6 @@ describe('robots.txt', () => {
3129 } )
3230 } )
3331
34- it ( 'disallows indexing of WIP localized content' , async ( ) => {
35- Object . values ( languages )
36- . filter ( language => language . wip )
37- . forEach ( language => {
38- expect ( robots . isAllowed ( `https://docs.github.com/${ language . code } ` ) ) . toBe ( false )
39- expect ( robots . isAllowed ( `https://docs.github.com/${ language . code } /articles/verifying-your-email-address` ) ) . toBe ( false )
40- } )
41- } )
42-
4332 it ( 'disallows indexing of herokuapp.com domains' , async ( ) => {
4433 const req = {
4534 hostname : 'docs-internal-12345--my-branch.herokuapp.com' ,
@@ -52,89 +41,6 @@ describe('robots.txt', () => {
5241 expect ( res . _getString ( ) ) . toEqual ( 'User-agent: *\nDisallow: /' )
5342 } )
5443
55- it ( 'disallows indexing of WIP products' , async ( ) => {
56- const wipProductIds = Object . values ( products )
57- . filter ( product => product . wip )
58- . map ( product => product . id )
59-
60- wipProductIds . forEach ( id => {
61- const { href } = products [ id ]
62- const blockedPaths = [
63- // English
64- `https://docs.github.com/en${ href } ` ,
65- `https://docs.github.com/en${ href } /overview` ,
66- `https://docs.github.com/en${ href } /overview/intro` ,
67- `https://docs.github.com/en/enterprise/${ enterpriseServerReleases . latest } /user${ href } ` ,
68- `https://docs.github.com/en/enterprise/${ enterpriseServerReleases . oldestSupported } /user${ href } ` ,
69-
70- // Japanese
71- `https://docs.github.com/ja${ href } ` ,
72- `https://docs.github.com/ja${ href } /overview` ,
73- `https://docs.github.com/ja${ href } /overview/intro` ,
74- `https://docs.github.com/ja/enterprise/${ enterpriseServerReleases . latest } /user${ href } ` ,
75- `https://docs.github.com/ja/enterprise/${ enterpriseServerReleases . oldestSupported } /user${ href } `
76- ]
77-
78- blockedPaths . forEach ( path => {
79- expect ( robots . isAllowed ( path ) ) . toBe ( false )
80- } )
81- } )
82- } )
83-
84- it ( 'disallows indexing of early access "hidden" products' , async ( ) => {
85- const hiddenProductIds = Object . values ( products )
86- . filter ( product => product . hidden )
87- . map ( product => product . id )
88-
89- hiddenProductIds . forEach ( id => {
90- const { versions } = products [ id ]
91- const blockedPaths = versions . map ( version => {
92- return [
93- // English
94- `https://docs.github.com/en/${ version } /${ id } ` ,
95- `https://docs.github.com/en/${ version } /${ id } /some-early-access-article` ,
96- // Japanese
97- `https://docs.github.com/ja/${ version } /${ id } ` ,
98- `https://docs.github.com/ja/${ version } /${ id } /some-early-access-article`
99- ]
100- } ) . flat ( )
101-
102- blockedPaths . forEach ( path => {
103- expect ( robots . isAllowed ( path ) ) . toBe ( false )
104- } )
105- } )
106- } )
107-
108- it ( 'allows indexing of non-WIP products' , async ( ) => {
109- expect ( 'actions' in products ) . toBe ( true )
110- expect ( robots . isAllowed ( 'https://docs.github.com/en/actions' ) ) . toBe ( true )
111- expect ( robots . isAllowed ( 'https://docs.github.com/en/actions/overview' ) ) . toBe ( true )
112- expect ( robots . isAllowed ( 'https://docs.github.com/en/actions/overview/intro' ) ) . toBe ( true )
113- expect ( robots . isAllowed ( `https://docs.github.com/en/enterprise/${ enterpriseServerReleases . latest } /user/actions` ) ) . toBe ( true )
114- expect ( robots . isAllowed ( `https://docs.github.com/en/enterprise/${ enterpriseServerReleases . oldestSupported } /user/actions` ) ) . toBe ( true )
115- } )
116-
117- it ( 'disallows indexing of deprecated enterprise releases' , async ( ) => {
118- enterpriseServerReleases . deprecated . forEach ( version => {
119- const blockedPaths = [
120- // English
121- `https://docs.github.com/en/enterprise-server@${ version } /actions` ,
122- `https://docs.github.com/en/enterprise/${ version } /actions` ,
123- `https://docs.github.com/en/enterprise-server@${ version } /actions/overview` ,
124- `https://docs.github.com/en/enterprise/${ version } /actions/overview` ,
125- // Japanese
126- `https://docs.github.com/ja/enterprise-server@${ version } /actions` ,
127- `https://docs.github.com/ja/enterprise/${ version } /actions` ,
128- `https://docs.github.com/ja/enterprise-server@${ version } /actions/overview` ,
129- `https://docs.github.com/ja/enterprise/${ version } /actions/overview`
130- ]
131-
132- blockedPaths . forEach ( path => {
133- expect ( robots . isAllowed ( path ) ) . toBe ( false )
134- } )
135- } )
136- } )
137-
13844 it ( 'does not have duplicate lines' , ( ) => {
13945 const lines = new Set ( )
14046 for ( const line of res . text . split ( '\n' ) ) {
0 commit comments