40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
import { describe, expect } from '@jest/globals'
|
|
|
|
import { getOpenApiSchemaFiles } from '../../src/rest/scripts/utils/sync.js'
|
|
import { allVersions } from '../../lib/all-versions.js'
|
|
|
|
const supportedReleases = Object.keys(allVersions).map(
|
|
(version) => allVersions[version].openApiVersionName
|
|
)
|
|
describe('decorated static files are generated correctly from dereferenced openapi files', () => {
|
|
// If there is a request with no request body parameters and all of
|
|
// the responses have no content, then we can create a docs
|
|
// example for just status codes below 300. All other status codes will
|
|
// be listed in the status code table in the docs.
|
|
test('webhook schema list should not include calendar date versions', async () => {
|
|
const schemas = [
|
|
'fpt-2022-08-09.json',
|
|
'fpt-2022-10-09.json',
|
|
'fpt-2022-11-09.json',
|
|
'ghec-2022-09-09.json',
|
|
...supportedReleases,
|
|
]
|
|
|
|
const expectedRestSchemas = [
|
|
'fpt-2022-08-09.json',
|
|
'fpt-2022-10-09.json',
|
|
'fpt-2022-11-09.json',
|
|
'ghec-2022-09-09.json',
|
|
...supportedReleases
|
|
.filter((release) => release !== 'ghec' && release !== 'fpt')
|
|
.map((release) => `${release}.json`),
|
|
]
|
|
|
|
const { restSchemas, webhookSchemas } = await getOpenApiSchemaFiles(schemas)
|
|
expect(restSchemas.sort()).toEqual(expectedRestSchemas.sort())
|
|
expect(webhookSchemas.sort()).toEqual(
|
|
supportedReleases.sort().map((release) => `${release}.json`)
|
|
)
|
|
})
|
|
})
|