1
0
mirror of synced 2025-12-22 11:26:57 -05:00

move schema check openapi tests into feature directories (#35932)

This commit is contained in:
Rachael Sewell
2023-03-28 09:33:58 -07:00
committed by GitHub
parent 8111a37cd5
commit 97ab8dc520
4 changed files with 58 additions and 39 deletions

View File

@@ -0,0 +1,32 @@
import { describe, expect } from '@jest/globals'
import { getOpenApiSchemaFiles } from '../scripts/utils/sync.js'
import { allVersions } from '../../../lib/all-versions.js'
const supportedReleases = Object.keys(allVersions).map(
(version) => allVersions[version].openApiVersionName
)
describe('rest data files are generated correctly from dereferenced openapi files', () => {
test('rest schema list should 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 } = await getOpenApiSchemaFiles(schemas)
expect(restSchemas.sort()).toEqual(expectedRestSchemas.sort())
})
})

View File

@@ -0,0 +1,24 @@
import { describe, expect } from '@jest/globals'
import { getOpenApiSchemaFiles } from '../../rest/scripts/utils/sync.js'
import { allVersions } from '../../../lib/all-versions.js'
describe('webhook data files are generated correctly from dereferenced openapi files', () => {
test('webhook schema list should not include calendar date versions', async () => {
const supportedReleases = Object.keys(allVersions).map(
(version) => allVersions[version].openApiVersionName
)
const schemas = [
'fpt-2022-08-09.json',
'fpt-2022-10-09.json',
'fpt-2022-11-09.json',
'ghec-2022-09-09.json',
...supportedReleases,
]
const { webhookSchemas } = await getOpenApiSchemaFiles(schemas)
expect(webhookSchemas.sort()).toEqual(
supportedReleases.sort().map((release) => `${release}.json`)
)
})
})