1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/tests/unit/graphql.js
2023-02-11 00:38:27 +00:00

44 lines
1.3 KiB
JavaScript

import { describe } from '@jest/globals'
import { readFileSync } from 'fs'
import { allVersions } from '../../lib/all-versions.js'
import {
getGraphqlSchema,
getGraphqlChangelog,
getGraphqlBreakingChanges,
getPreviews,
} from '../../src/graphql/lib/index.js'
describe('graphql schema', () => {
const graphqlTypes = JSON.parse(readFileSync('src/graphql/lib/types.json')).map(
(item) => item.kind
)
for (const version in allVersions) {
for (const type of graphqlTypes) {
test(`getting the GraphQL ${type} schema works for ${version}`, async () => {
const schema = getGraphqlSchema(version, type)
expect(schema).toBeDefined()
})
}
}
test('getting the graphql changelog works for dotcom', async () => {
const defaultVersion = allVersions.defaultVersion
const schema = getGraphqlChangelog(defaultVersion)
expect(schema).toBeDefined()
})
test('getting the graphql breaking changes works for every version', async () => {
for (const version in allVersions) {
const schema = getGraphqlBreakingChanges(version)
expect(schema).toBeDefined()
}
})
test('getting the graphql previews works for every version', async () => {
for (const version in allVersions) {
const schema = getPreviews(version)
expect(schema).toBeDefined()
}
})
})