fix(v2): docs plugin stability improvement (100% test coverage) (#1912)

* update jest config

* add more tests on docs plugin

* fix(v2): docs plugin should not add routes if there are no docs

* fix

* rm -rf coverage

* nits

* update
This commit is contained in:
Endi 2019-10-29 22:59:27 +07:00 committed by Yangshun Tay
parent ad22c9fab4
commit a8826b98b3
26 changed files with 464 additions and 71 deletions

View file

@ -177,9 +177,8 @@ export default function pluginContentDocs(
case 'doc':
return convertDocLink(item as SidebarItemDoc);
case 'link':
break;
default:
throw new Error(`Unknown sidebar item type: ${item.type}`);
break;
}
return item as SidebarItemLink;
});
@ -208,7 +207,7 @@ export default function pluginContentDocs(
},
async contentLoaded({content, actions}) {
if (!content) {
if (!content || Object.keys(content.docsMetadata).length === 0) {
return;
}