1
1
import { jest , test } from '@jest/globals'
2
2
import { slug } from 'github-slugger'
3
- import { readdirSync , readFileSync } from 'fs'
4
- import path from 'path'
5
3
6
- import { get , getDOM } from '../../../tests/helpers/e2etest.js'
4
+ import { getDOM } from '../../../tests/helpers/e2etest.js'
7
5
import { isApiVersioned , allVersions } from '../../../lib/all-versions.js'
8
6
import { getDiffOpenAPIContentRest } from '../scripts/test-open-api-schema.js'
9
- import getRest , { REST_DATA_DIR , REST_SCHEMA_FILENAME } from '#src/rest/lib/index.js'
7
+ import getRest from '#src/rest/lib/index.js'
10
8
11
9
describe ( 'REST references docs' , ( ) => {
12
10
jest . setTimeout ( 3 * 60 * 1000 )
@@ -27,40 +25,6 @@ describe('REST references docs', () => {
27
25
}
28
26
} )
29
27
30
- test ( 'all category and subcategory REST pages render for free-pro-team' , async ( ) => {
31
- // This currently just grabs the 'free-pro-team' schema, but ideally, we'd
32
- // get a list of all categories across all versions.
33
- const freeProTeamVersion = readdirSync ( REST_DATA_DIR )
34
- . filter ( ( file ) => file . startsWith ( 'fpt' ) )
35
- . shift ( )
36
- const freeProTeamSchema = JSON . parse (
37
- readFileSync ( path . join ( REST_DATA_DIR , freeProTeamVersion , REST_SCHEMA_FILENAME ) , 'utf8' )
38
- )
39
-
40
- const restCategories = Object . entries ( freeProTeamSchema )
41
- . map ( ( [ key , subCategory ] ) => {
42
- const subCategoryKeys = Object . keys ( subCategory )
43
- if ( subCategoryKeys . length === 1 ) {
44
- return key
45
- } else {
46
- return subCategoryKeys . map ( ( elem ) => `${ key } /${ elem } ` )
47
- }
48
- } )
49
- . flat ( )
50
-
51
- const statusCodes = await Promise . all (
52
- restCategories . map ( async ( page ) => {
53
- const url = `/en/rest/${ page } `
54
- const res = await get ( url )
55
- return [ url , res . statusCode ]
56
- } )
57
- )
58
- for ( const [ url , status ] of statusCodes ) {
59
- expect ( status , url ) . toBe ( 200 )
60
- }
61
- expect . assertions ( restCategories . length )
62
- } )
63
-
64
28
test ( 'test the latest version of the OpenAPI schema categories/subcategories to see if it matches the content/rest directory' , async ( ) => {
65
29
const differences = await getDiffOpenAPIContentRest ( )
66
30
const errorMessage = formatErrors ( differences )
0 commit comments