mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-21 10:37:51 +02:00
test: improve test coverage; multiple internal refactors (#6912)
This commit is contained in:
parent
12a7305238
commit
ad88f5cc87
78 changed files with 1613 additions and 1149 deletions
|
@ -376,18 +376,13 @@ export function toNavigationLink(
|
|||
return undefined;
|
||||
}
|
||||
|
||||
if (navigationItem.type === 'doc') {
|
||||
return toDocNavigationLink(getDocById(navigationItem.id));
|
||||
} else if (navigationItem.type === 'category') {
|
||||
if (navigationItem.link.type === 'doc') {
|
||||
return toDocNavigationLink(getDocById(navigationItem.link.id));
|
||||
} else if (navigationItem.link.type === 'generated-index') {
|
||||
return {
|
||||
title: navigationItem.label,
|
||||
permalink: navigationItem.link.permalink,
|
||||
};
|
||||
}
|
||||
throw new Error('unexpected category link type');
|
||||
if (navigationItem.type === 'category') {
|
||||
return navigationItem.link.type === 'doc'
|
||||
? toDocNavigationLink(getDocById(navigationItem.link.id))
|
||||
: {
|
||||
title: navigationItem.label,
|
||||
permalink: navigationItem.link.permalink,
|
||||
};
|
||||
}
|
||||
throw new Error('unexpected navigation item');
|
||||
return toDocNavigationLink(getDocById(navigationItem.id));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue