1
0
mirror of synced 2026-01-05 12:07:35 -05:00
Files
docs/tests/content/glossary.js
Kevin Heis 303d5190db Create a translations test suite (#30000)
* Scaffold files for migration

* Move user-agent into unit suite

* Nothing to move from browser suite

* Migrate tests to translations/content

* Migrate existing translation test to meta

* No graphql tests to migrate

* Migrate lint-translation-reporter

* Migrate lint-translation-reporter

* Remove languages-schema, unused

* Restore languages-schema

* Restore languages-schema

* Migrate rendering

* Migrate routing

* Migrate most of unit

* Remove dead files, comment out tests that aren't expected to work yet

* Migrate from get-redirect

* Migrate page and pages

* Migrate linting code

* Fix lint issues

* Found a few more

* Run prettier

* Move crowdin-config test and helper

* Update crowdin-config.js

* Remove translation linting, crowdin config lint, reduce file count

* Remove test that's been skipped for a year

* Restore linting with note to remove later

* Update lint-translation-reporter.js

* Clean up rendering suite

* Update rendering.js

* Remove excessive describe blocks

* Redirect tests

* Clean up unit

* Remove test that's never called

* Don't compare early access

* Rename test suites

* Update "content" tests

* Update files.js

* Update search.js

* Update files.js

* Update files.js
2022-08-25 12:38:03 -07:00

48 lines
1.8 KiB
JavaScript

import loadSiteData from '../../lib/site-data.js'
describe('glossaries', () => {
const glossaries = loadSiteData().en.site.data.glossaries
test('are broken into external, internal, and candidates', async () => {
const keys = Object.keys(glossaries)
expect(keys).toHaveLength(3)
expect(keys).toContain('candidates')
expect(keys).toContain('external')
expect(keys).toContain('internal')
})
test('every entry has a valid term', async () => {
function hasValidTerm(entry) {
return entry.term && entry.term.length && !entry.term.includes('*')
}
expect(glossaries.external.every(hasValidTerm)).toBe(true)
expect(glossaries.internal.every(hasValidTerm)).toBe(true)
expect(glossaries.candidates.every(hasValidTerm)).toBe(true)
})
test('external glossary has entries, and they all have descriptions', async () => {
expect(glossaries.external.length).toBeGreaterThan(20)
glossaries.external.forEach((entry) => {
const message = `entry '${entry.term}' is missing a description`
expect(entry.description && entry.description.length > 0, message).toBe(true)
})
})
test('internal glossary has entries, and they all have descriptions', async () => {
expect(glossaries.internal.length).toBeGreaterThan(20)
glossaries.internal.forEach((entry) => {
const message = `entry '${entry.term}' is missing a description`
expect(entry.description && entry.description.length > 0, message).toBe(true)
})
})
test('candidates all have a term, but no description', async () => {
expect(glossaries.candidates.length).toBeGreaterThan(20)
glossaries.candidates.forEach((entry) => {
const message = `entry '${entry.term}' not expected to have a description`
expect(!entry.description, message).toBe(true)
})
})
})