1
1
mirror of https://github.com/primer/css.git synced 2024-09-11 16:36:07 +03:00
css/__tests__/docs.test.js

34 lines
807 B
JavaScript
Raw Normal View History

2021-03-31 02:53:47 +03:00
const {getNavigationLinks, getContentFrontmatter} = require('./utils/docs')
2021-03-30 20:01:19 +03:00
2021-03-31 02:53:47 +03:00
let navLinks, contentFM
2021-03-30 20:01:19 +03:00
2021-03-31 02:53:47 +03:00
beforeAll(async () => {
contentFM = await getContentFrontmatter()
navLinks = getNavigationLinks()
2021-03-30 20:01:19 +03:00
})
describe('frontmatter', () => {
2021-03-31 02:53:47 +03:00
it('page title matches link title', () => {
navLinks.forEach(link => {
const content = contentFM[link['url']]
expect(content).not.toBeNull()
expect(content['title']).toBe(link['title'])
})
})
2021-03-30 20:01:19 +03:00
2021-03-31 02:53:47 +03:00
it('contains path attribute', () => {
Object.values(contentFM).forEach( v => {
expect(v['path']).not.toBeNull()
})
})
2021-03-30 20:01:19 +03:00
})
describe('navigation', () => {
it('has a file for each nav item', () => {
2021-03-31 02:53:47 +03:00
navLinks.forEach(link => {
const content = contentFM[link['url']]
expect(content).not.toBeNull()
})
2021-03-30 20:01:19 +03:00
})
})