Skip to content

Commit d7e76b3

Browse files
authored
remove duplicate rest test (#38578)
1 parent 6f3a0c7 commit d7e76b3

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

src/rest/tests/rendering.js

+2-38
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { jest, test } from '@jest/globals'
22
import { slug } from 'github-slugger'
3-
import { readdirSync, readFileSync } from 'fs'
4-
import path from 'path'
53

6-
import { get, getDOM } from '../../../tests/helpers/e2etest.js'
4+
import { getDOM } from '../../../tests/helpers/e2etest.js'
75
import { isApiVersioned, allVersions } from '../../../lib/all-versions.js'
86
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'
108

119
describe('REST references docs', () => {
1210
jest.setTimeout(3 * 60 * 1000)
@@ -27,40 +25,6 @@ describe('REST references docs', () => {
2725
}
2826
})
2927

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-
6428
test('test the latest version of the OpenAPI schema categories/subcategories to see if it matches the content/rest directory', async () => {
6529
const differences = await getDiffOpenAPIContentRest()
6630
const errorMessage = formatErrors(differences)

0 commit comments

Comments
 (0)