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', () => {
|
2021-04-01 20:56:12 +03:00
|
|
|
for (const link of navLinks) {
|
2021-03-31 02:53:47 +03:00
|
|
|
const content = contentFM[link['url']]
|
|
|
|
expect(content).not.toBeNull()
|
|
|
|
expect(content['title']).toBe(link['title'])
|
2021-04-01 20:56:12 +03:00
|
|
|
}
|
2021-03-31 02:53:47 +03:00
|
|
|
})
|
2021-03-30 20:01:19 +03:00
|
|
|
|
2021-03-31 02:53:47 +03:00
|
|
|
it('contains path attribute', () => {
|
2021-04-01 20:56:12 +03:00
|
|
|
for (const v of Object.values(contentFM)) {
|
2021-03-31 02:53:47 +03:00
|
|
|
expect(v['path']).not.toBeNull()
|
2021-04-01 20:56:12 +03:00
|
|
|
}
|
2021-03-31 02:53:47 +03:00
|
|
|
})
|
2021-03-30 20:01:19 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('navigation', () => {
|
|
|
|
it('has a file for each nav item', () => {
|
2021-04-01 20:56:12 +03:00
|
|
|
for (const link of navLinks) {
|
2021-03-31 02:53:47 +03:00
|
|
|
const content = contentFM[link['url']]
|
|
|
|
expect(content).not.toBeNull()
|
2021-04-01 20:56:12 +03:00
|
|
|
}
|
2021-03-30 20:01:19 +03:00
|
|
|
})
|
|
|
|
})
|