refactor(v2): better docs metadata (#1815)

This commit is contained in:
Endi 2019-10-09 12:07:08 +08:00 committed by GitHub
parent a04bd440b4
commit e7ba8af6d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 185 additions and 149 deletions

View file

@ -28,14 +28,15 @@ describe('loadDocs', () => {
path: pluginPath,
sidebarPath,
});
const {docs: docsMetadata} = await plugin.loadContent();
const {docsMetadata} = await plugin.loadContent();
expect(docsMetadata.hello).toEqual({
category: 'Guides',
id: 'hello',
permalink: '/docs/hello',
previous: 'foo/baz',
previous_title: 'baz',
previous: {
title: 'baz',
permalink: '/docs/foo/baz',
},
sidebar: 'docs',
source: path.join('@site', pluginPath, 'hello.md'),
title: 'Hello, World !',
@ -43,10 +44,11 @@ describe('loadDocs', () => {
});
expect(docsMetadata['foo/bar']).toEqual({
category: 'Test',
id: 'foo/bar',
next: 'foo/baz',
next_title: 'baz',
next: {
title: 'baz',
permalink: '/docs/foo/baz',
},
permalink: '/docs/foo/bar',
sidebar: 'docs',
source: path.join('@site', pluginPath, 'foo', 'bar.md'),