1
1
mirror of https://github.com/primer/css.git synced 2024-12-02 16:13:02 +03:00
css/__tests__/docs.test.js
2021-04-01 10:56:12 -07:00

34 lines
815 B
JavaScript

const {getNavigationLinks, getContentFrontmatter} = require('./utils/docs')
let navLinks, contentFM
beforeAll(async () => {
contentFM = await getContentFrontmatter()
navLinks = getNavigationLinks()
})
describe('frontmatter', () => {
it('page title matches link title', () => {
for (const link of navLinks) {
const content = contentFM[link['url']]
expect(content).not.toBeNull()
expect(content['title']).toBe(link['title'])
}
})
it('contains path attribute', () => {
for (const v of Object.values(contentFM)) {
expect(v['path']).not.toBeNull()
}
})
})
describe('navigation', () => {
it('has a file for each nav item', () => {
for (const link of navLinks) {
const content = contentFM[link['url']]
expect(content).not.toBeNull()
}
})
})