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

@ -21,10 +21,6 @@ function getCategoryGeneratedIndexMetadata({
}): CategoryGeneratedIndexMetadata {
const {sidebarName, previous, next} =
sidebarsUtils.getCategoryGeneratedIndexNavigation(category.link.permalink);
if (!sidebarName) {
throw new Error('unexpected');
}
return {
title: category.link.title ?? category.label,
description: category.link.description,
@ -32,7 +28,7 @@ function getCategoryGeneratedIndexMetadata({
keywords: category.link.keywords,
slug: category.link.slug,
permalink: category.link.permalink,
sidebar: sidebarName,
sidebar: sidebarName!,
previous: toNavigationLink(previous, docsById),
next: toNavigationLink(next, docsById),
};