mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-20 11:37:52 +02:00
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:
parent
ad22c9fab4
commit
a8826b98b3
26 changed files with 464 additions and 71 deletions
|
@ -44,7 +44,7 @@ function normalizeCategory(
|
|||
|
||||
if (!Array.isArray(category.items)) {
|
||||
throw new Error(
|
||||
`Error loading ${category.label} category. Category items must be array.`,
|
||||
`Error loading "${category.label}" category. Category items must be array.`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -62,15 +62,11 @@ function normalizeCategory(
|
|||
assertItem(item, ['href', 'label']);
|
||||
break;
|
||||
case 'ref':
|
||||
case 'doc':
|
||||
assertItem(item, ['id']);
|
||||
break;
|
||||
default:
|
||||
if (item.type !== 'doc') {
|
||||
throw new Error(`Unknown sidebar item type: ${item.type}`);
|
||||
}
|
||||
|
||||
assertItem(item, ['id']);
|
||||
break;
|
||||
throw new Error(`Unknown sidebar item type: ${item.type}`);
|
||||
}
|
||||
|
||||
return item as SidebarItem;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue