test: improve test coverage (#6857)

This commit is contained in:
Joshua Chen 2022-03-06 17:55:21 +08:00 committed by GitHub
parent edb4d00096
commit f763ac13a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 435 additions and 220 deletions

View file

@ -258,11 +258,7 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
const sidebarName = Object.entries(sidebarNameToNavigationItems).find(
([, navigationItems]) =>
navigationItems.find(isCurrentCategoryGeneratedIndexItem),
)?.[0];
if (!sidebarName) {
return emptySidebarNavigation();
}
)![0];
const navigationItems = sidebarNameToNavigationItems[sidebarName]!;
const currentItemIndex = navigationItems.findIndex(
isCurrentCategoryGeneratedIndexItem,