1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/tests/unit/graphql.js
2022-08-03 10:51:21 -07:00

42 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 '../../lib/graphql/index.js'
describe('graphql schema', () => {
const graphqlTypes = JSON.parse(readFileSync('lib/graphql/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()
}
})
})